feat: update OpenFeature React example #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR updates the OpenFeature React example for compatibility with a new OpenFeature article.
Notable Changes
docker composeinstances (or their own hosted version).react-scriptsfor Vite.Testing React App
Setup
open-feature/react/folder in your IDE..env.exampleto.envfile.REACT_APP_FLAGSMITH_ENVIRONMENT_IDproperty in the.envfile:nvm useto use the Node version located in.nvmrc(v22). If you do not havenvminstalled, visit here to install: https://github.com/nvm-sh/nvmnpm ito install dependencies.Flagsmith Setup
Ensure you have a
font_sizefeature set in Flagsmith with a numeric value.16is used in this example.Add a Segment Override for
example_traitwith a value of1and set the overridden value to17.Run the App
npm startto start the dev server.Open the browser, and you should see the following:
Click the "Login" button, which will set the
example_traitproperty in the Flagsmith provider to1, and you should see a17as thefont_sizevalue:Testing
checkEnv.jsWithin the
npm startscript inpackage.json, there's a preliminary run to executecheckEnv.jsfirst. This script checks if the.env.examplefile is properly copied and configured during initial setup. This is meant to help ensure people are reminded to set up this.envfile correctly before they attempt to run this demo.If the
.env.examplefile is not copied to.envyet, and you runnpm start, you should see this error:If
.env.exampleis copied to.env, but the Flagsmith environment ID is not updated, you should see this error:TODO