Skip to content
Load environment settings for react asynchronously at runtime
TypeScript JavaScript HTML CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
example2
src
.editorconfig
.gitignore
.travis.yml
README.md
package.json
rollup.config.js
tsconfig.json
tsconfig.test.json
yarn.lock

README.md

react-environment-settings

Load environment settings for react asynchronously at runtime

NPM JavaScript Style Guide

Install

npm install --save react-environment-settings

Usage

import React from "react";

import AppSettingsLoader from "react-environment-settings";
import settingsAssetUrl from "./settings.json.txt";

interface Settings {
  data: string;
}

const App = () => {
  return (
    <div className="root">
      <AppSettingsLoader<Settings>
        settingsUrl={settingsAssetUrl}
        loading={() => <div>Loading settings...</div>}
        ready={s => <pre>{JSON.stringify(s, null, 2)}</pre>}
      />
    </div>
  );
};

export default App;

License

MIT © daniellittledev

You can’t perform that action at this time.