flags/react
APIs for working with feature flags in React.
If you are using React, you can use the FlagValues and FlagDefinitions components. These abstract you from needing to manually render script tags.
These components handle setting the correct data attributes and escaping any data to prevent XSS.
FlagValues
This component is a convenience method to render the script tag which is used by the Flags Explorer and Web Analytics to learn about the values your feature flags evaluated to.
Pass flag data into the FlagValues component with the values prop.
| Prop | Type | Description |
|---|---|---|
values | FlagValuesType | The feature flag values to expose to the Vercel Toolbar |
To keep your flags confidential, encrypt the input:
FlagDefinitions
This component is a convenience method to render the script tag which is used by the Flags Explorer to learn metadata about your feature flags, like the description.
Pass flag data into the FlagDefinitions component with the definitions prop.
| Prop | Type | Description |
|---|---|---|
definitions | FlagDefinitionsType | The feature flag definitions to expose to the Vercel Toolbar |
To keep your flags confidential, encrypt the input: