Skip to content

Hook that provides runtime configuration via a hosted config.json file

License

Notifications You must be signed in to change notification settings

Unholster/react-use-config

Repository files navigation

react-use-config

Hook that provides runtime configuration via a hosted config.json file

Example

import { useConfig, ConfigProvider } from '@unholster/react-use-config'

const CONFIG_PATH = ...

// to set default config add new or derive from existing config. Is optional.
const configAdapter = (config: ConfigType): AdaptedConfigType => {
  return {
    ...config,
    // add any additional properties here
  }
}

<ConfigProvider configPath={CONFIG_PATH} configAdapter={configAdapter} >
  <App />
</ConfigProvider>


function App() {
  const config = useConfig<AdaptedConfigType>()
  ...
}

About

Hook that provides runtime configuration via a hosted config.json file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published