useProvidedScope

Low-level React Hook, which returns current Scope from Provider.

This is a Low-Level API

The useProvidedScope hook is a low-level API for a library developers and is not intended to be used in production code directly.

For production effector-react usage see the useUnit hook.

useProvidedScope()

Returns

  • Scope or null, if no Scope provided.

Example

This hook can be used in library internals to handle various edge-cases, where createWatch and scopeBind APIs are also needed.

For production code usage see the useUnit hook instead.

const useCustomLibraryInternals = () => {
  const scope = useProvidedScope();

  // ...
};
Contributors