Skip to main content

React SDK

The official React SDK for Replane. Provides hooks and context for seamless React integration with realtime updates.

Installation

npm install @replanejs/react

Requirements

  • React 18.0.0 or higher
  • Node.js 18.0.0 or higher

Quick start

import { ReplaneProvider, useConfig } from '@replanejs/react';

function App() {
return (
<ReplaneProvider
connection={{
baseUrl: 'https://replane.example.com',
sdkKey: process.env.REPLANE_SDK_KEY,
}}
loader={<div>Loading...</div>}
>
<MyComponent />
</ReplaneProvider>
);
}

function MyComponent() {
const isFeatureEnabled = useConfig<boolean>('feature-flag');

return (
<div>
{isFeatureEnabled ? 'Feature is enabled!' : 'Feature is disabled'}
</div>
);
}

Features

  • React hooksuseConfig and useReplane for easy access
  • Automatic re-renders — Components update when configs change
  • Suspense support — Optional React Suspense integration
  • SSR ready — Snapshot hydration for server-side rendering
  • Type-safe — Full TypeScript support with typed hooks

Next steps