- Go to Firebase Console and create a new Firebase Project.
- Navigate to Remote Config and create a Boolean Flag Named
feature_enable_dark_mode
git clone https://github.com/Safnaj/devfest-2023-demo.git
- Inside the project folder create a file called
.env
- Refer the
.env.example
and add the values as shown below
REACT_APP_FIREBASE_API_KEY=YOUR_API_KEY
REACT_APP_FIREBASE_AUTH_DOMAIN=YOUR_AUTH_DOMAIN
REACT_APP_FIREBASE_PROJECT_ID=YOUR_PROJECT_ID
REACT_APP_FIREBASE_STORAGE_BUCKET=YOUR_STORAGE_BUCKET
REACT_APP_FIREBASE_MESSAGING_SENDER_ID=YOUR_MESSAGING_SENDER_ID
REACT_APP_FIREBASE_APP_ID=YOUR_APP_ID
REACT_APP_FIREBASE_MEASUREMENT_ID=YOUR_MEASUREMENT_ID
- Go to
src/config/remoteConfig.js
and inside theinitRemoteConfig
add your flag and it's default value.
- Move to
src/constants/flags.js
and create a constant for your flag:
export const FEATURE_ENABLE_DARK_MODE = 'feature_enable_dark_mode';
- Check your flag value using
isFeatureEnabled
function and write your logic
Ex:const isShowStatsEnabled = isFeatureEnabled(FEATURE_ENABLE_STATS);