Skip to content

daniellittledev/react-environment-settings

Repository files navigation

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

About

Load environment settings for react asynchronously at runtime

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published