react-configure
Lightweight library to handle your React app static configs and feature-flags
This library lets you define:
- Static configurations like
backendUrl
; - Feature-flags like
enableChat
,enableCommentsSection
; - Multiple environments, each with its own configuration, like
dev
,qa
,prod
, etc.
It also selects which environment your application is running on based on:
- Environment variable (
REACT_APP_ENVIRONMENT
orSTORYBOOK_ENVIRONMENT
); - Current hostname like;
-> If an environment variable is defined, the library will ignore the current hostname!
This way you only have to worry about importing your configs and using them. The library will select the right environment, configs and feature-flags for you.
Install
npm i --save react-configure
Setup
Using typescript
configuration.ts
; ; ; ; ;;;
Usage
;; console.log`Current backend url is `; ;