Open rishi-raj-jain opened 9 months ago
Requesting a review from @nnennandukwe & @nunogois.
Looks good so far! the dependent feature flag would have a unique name (different from the parent flag), correct?
the dependent feature flag would have a unique name (different from the parent flag), correct?
Yeah, totally. The name for that would be upi
, I've updated the outline.
Two minor comments:
@nnennandukwe
May I have your confirmation to proceed on this? I'd love to get this done, pardon the absence.
"Using Unleash in Production" section doesn't seem to be related to the topic of Dependent Flags and more like a topic for a different piece of content.
Cool yeah, even in this case, it's going to be working directly in production and not a local setup.
Headlines could have more consistent format. I like to use the first items on the list to establish a pattern. E.g. start all items with a verb or noun. More: https://developers.google.com/tech-writing/one/lists-and-tables
Sure thing. Let me get this done once I have a confirmation to work on this.
Outline 👇🏻
How to Implement Dependent Feature Flags in React using Unleash
In this tutorial, you will learn how to use dependent feature flags in a React application that'll offer Unified Payments Interface (UPI) as the payment method only if Instant Payment is enabled in the first place for the user. We will use the
@unleash/proxy-client-react
package, which provides easy integration of Unleash feature flags in a React application.What we’ll be using
Mention:
What you’ll need
Setting up the project
To set up, just clone the app repo and follow this tutorial to learn everything that's in it. To fork the project, run:
Scaffolding a React app
Creating a React app is as easy as a single command:
Setup Unleash
docker-compose.yml
for creating an Unleash instance outside of your current project directory:This will start Unleash in the background. Once Unleash is running, you can access it at http://localhost:4242/.
Create a New Feature Flag
Create a new feature flag in your Unleash instance named
instant-payments
.Create a Dependent Feature Flag
Create a new feature flag in your Unleash instance named
upi
.Integrating Unleash in a React app
Installation
To get started with React and Unleash, you need to install
@unleash/proxy-client-react
package as a dependency.You can run the following commands in your terminal to do this:
Set up Environment Variables
By default, the following values are setup in your local Unleash instance
Initialise Unleash SDK
Use Unleash SDK to fetch the dependent feature flag value
Scenarios
Revert: Scenarios
Using Unleash in Production
To setup Unleash for production, please follow the steps below:
Conclusion