import { useProvidedScope } from "effector-react";

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 library developers and is not intended to be used in production code directly.

For production effector-react usage, see the useUnit hook.

Methods

useProvidedScope()

Formulae

useProvidedScope(): Scope | null

Returns

(Scope | null) — if no Scope provided, returns null.

Examples

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