Appearance
@shtse8/fluxus / react-adapter / useProvider
Function: useProvider()
useProvider<
T>(provider):T
Defined in: react-adapter/hooks.ts:27
A React hook that reads a provider's value from the current Scope and subscribes to updates.
The component calling this hook will re-render whenever the provider's state changes in the scope. It uses useSyncExternalStore internally to ensure compatibility with concurrent rendering features in React.
Must be used within a ProviderScope.
Type Parameters
T
T
The type of the value provided by the provider.
Parameters
provider
Provider<T>
The provider whose value is to be read and watched.
Returns
T
The current value of the provider.
Throws
If used outside of a ProviderScope.
Throws
If the provider state has been disposed.
Throws
If a circular dependency is detected during initialization.