Skip to main content
The React SDK provides a provider and a set of hooks. Flags re-evaluate automatically when your configuration changes, so your components always render the current value.

Install

Set up the provider

Wrap your app in SoftlaunchProvider with a client key (slc_). The provider loads your configuration and keeps it up to date.

Read a flag

Each flag type has a hook. Pass the flag key, a subject key, attributes, and a default value.
Available hooks:
  • useBooleanFlag(flagKey, subjectKey, attributes, defaultValue)
  • useStringFlag(flagKey, subjectKey, attributes, defaultValue)
  • useIntegerFlag(flagKey, subjectKey, attributes, defaultValue)
  • useNumericFlag(flagKey, subjectKey, attributes, defaultValue)
  • useJsonFlag<T>(flagKey, subjectKey, attributes, defaultValue)

The result object

Every hook returns the same shape:
Hooks re-render when your configuration updates, so you don’t need to poll or refresh. Just read value.