Feato logoFeato

React SDK

The Feato React SDK provides real-time access to feature flags inside React applications using a simple hook-based API.

It maintains a persistent connection to Feato and keeps feature flags synchronized automatically as changes occur.

Designed for React

The SDK is framework-native and integrates naturally with React rendering and state updates.


Installation

Install the Feato React SDK using your preferred package manager.

Package name

@feato/react-client

The SDK has no peer dependencies other than React itself.


Setup

Initialize the Feato client at the root of your application by providing a project key and environment.

The client is typically created once and shared across the application.

Initialization

Initialization includes an initial fetch of feature flags and preparation of the real-time connection.

Once initialized, the SDK keeps the local flag state in sync automatically.


Hooks

The React SDK exposes hooks that allow components to read feature flags and react to updates.

  • Hooks re-render components automatically when flags change
  • No manual subscriptions are required
  • Updates propagate instantly
Real-time behavior

When a feature flag is updated in the Feato Console, all subscribed components receive the new value immediately.


Examples

Feature flags can be used to control rendering, behavior, or application flows.

  • Conditional rendering of UI elements
  • Gradual rollout of new features
  • Instant feature rollback
Best practice

Feature flags should guard behavior, not replace application logic. Keep flag usage explicit and intentional.


Next steps

After setting up the React SDK, you may want to explore related topics: