1.0.1 โข Published 4 years ago
react-remote-config v1.0.1
React Remote Config
The package allows to use environment configuration for static prebuilt react applications.
๐ฆ Installation
NPM
npm i react-remote-config
Yarn
yarn add react-remote-config
๐ฝ Usage
Import configuration loader in your src/index.js file:
import configLoader from 'react-remote-config';then replace
ReactDOM.render(<Application />, document.getElementById('root'));with
configLoader(dsn)
.then(() => {
    ReactDOM.render(<Application />, document.getElementById('root'));
})
.catch(() => {
    ReactDOM.render(<div>Couldn't get application configuration. Please, try to refresh the page.</div>, document.getElementById('root'));
});The package will download json formatted configuration located under
dsnURI. (defaults to/environment.json)
Use window.env.{param} to get configuration value in any application's file.
๐งจ Warning
The package currently do not work with SSR frameworks such as NextJS, Gatsby, etc.