New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ripple-react-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ripple-react-wrapper

Basic ripple react component wrapper

latest
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

Ripple React Wrapper

A lightweight wrapper component that enables seamless integration of React components within the Ripple framework.

Overview

The Ripple React Wrapper allows you to embed existing React components into Ripple applications, providing a bridge between the two frameworks. This is particularly useful when migrating from React to Ripple or when you want to reuse existing React components in a Ripple project.

Features

  • 🔄 Seamless Integration: Embed React components directly in Ripple
  • 🎯 Type Safety: Full TypeScript support with proper type definitions
  • 🚀 Performance: Efficient mounting and unmounting of React components
  • 📦 Lightweight: Minimal overhead with clean API
  • 🔧 Flexible: Pass props and HTML attributes easily

Installation

npm install ripple-react-wrapper
# or
pnpm add ripple-react-wrapper
# or
yarn add ripple-react-wrapper

Requirements

  • Node.js >= 20.0.0
  • React >= 18.2.0
  • Ripple >= 0.2.35

Usage

Basic Example

import { ReactWrapper } from 'ripple-react-wrapper';
import MyReactComponent from './MyReactComponent';

export component MyRippleComponent() {
  <ReactWrapper 
    component={MyReactComponent} 
    $props={{ title: "Hello from Ripple!" }}
    class="my-wrapper"
  />
}

React Component Setup

Important: React components used with this wrapper must include the following import at the top:

import * as React from 'react';

Example React component:

import * as React from 'react'; // Required!
import { useState } from 'react';

interface MyComponentProps {
  title?: string;
  initialCount?: number;
}

export default function MyComponent({ title = "Counter", initialCount = 0 }: MyComponentProps) {
  const [count, setCount] = useState(initialCount);

  return (
    <div>
      <h2>{title}</h2>
      <p>Count: {count}</p>
      <button onClick={() => setCount(count + 1)}>
        Increment
      </button>
    </div>
  );
}

Advanced Usage

import { ReactWrapper } from 'ripple-react-wrapper';
import ComplexComponent from './ComplexComponent';

export component AdvancedExample() {
  let componentProps = {
    data: [1, 2, 3, 4, 5],
    onItemClick: (item) => console.log('Clicked:', item),
    theme: 'dark'
  };

  <ReactWrapper 
    component={ComplexComponent}
    $props={componentProps}
    style="border: 1px solid #ccc; padding: 16px;"
    data-testid="react-wrapper"
  />
}

API Reference

ReactWrapper Props

PropTypeRequiredDescription
componentComponentType<any>The React component to render
$propsRecord<string, any>Props to pass to the React component
...otherPropsanyAdditional HTML attributes for the wrapper div

Types

interface ReactWrapperProps {
  component: ComponentType<any>;
  $props?: Record<string, any>;
  [key: string]: any;
}

type WrappableReactComponent<P = {}> = ComponentType<P>;
type ComponentProps<T> = T extends ComponentType<infer P> ? P : never;

How It Works

The wrapper creates a div element and uses React's createRoot API to mount your React component inside it. The component is properly unmounted when the Ripple component is destroyed, ensuring no memory leaks.

  • Mount: When the wrapper mounts, it creates a React root and renders your component
  • Props: Component props are passed through the $props attribute
  • Cleanup: When unmounting, the React root is properly cleaned up

Known Issues

  • React components must include import * as React from 'react'; at the top
  • TypeScript may show warnings for .ripple files (this is expected and being worked on)

Development

# Format code
npm run format

# Check formatting
npm run format:check

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

FAQs

Package last updated on 16 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts