Install
Set up the provider
Wrap your app inSoftlaunchProvider 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.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:| Field | Description |
|---|---|
value | The resolved variation, or your default value. |
isLoading | true during the first load, before any configuration is available. |
isFetching | true while refreshing in the background. value stays usable from the previous configuration. |
error | A message if the configuration failed to load, otherwise undefined. |
Hooks re-render when your configuration updates, so you don’t need to poll or refresh. Just read
value.