1.0.1 โ€ข Published 3 years ago

react-remote-config v1.0.1

Weekly downloads
2
License
GPL-3.0-or-later
Repository
github
Last release
3 years ago

React Remote Config

npm npm npm bundle size Snyk Vulnerabilities for npm package NPM

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 dsn URI. (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.

1.0.1

3 years ago

1.0.0

3 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago