Skip to main content
useAllConfigs() returns every configuration value as a Record<string, string>. The first render shows the cached values or the defaults. The hook then fetches the current values and re-renders when any value changes. Read Remote configuration.

Signature

Options

Result

Cache-first behavior

  1. On the first render, the hook reads client.getAllConfigs(). The result comes from the cache and from defaultConfigurations. There is no loading state.
  2. After mount, the hook calls client.fetchConfig with the options and replaces configs with the response.
  3. The hook subscribes to the configuration change listener of the client. Any change to any key replaces configs and re-renders the component.
  4. When the fetch fails, error holds the failure and configs keeps the cached or default values.
The hook fetches again when forceRefresh, immediateKeys, or properties change.
Define properties and immediateKeys outside the component or memoize them with useMemo. The hook compares them by reference. An object literal in the render body is a new object on every render, so the hook fetches on every render.

useAllConfigs or useConfig

Read useConfig.

Several values in one component

Refresh and errors