Skip to main content

useGlobalValue

Callable

  • useGlobalValue<Value>(key: unknown, initialValue: () => Value): Value

  • Return a new global value if not previously set. This is handful when using hot module reload.

    @example
    const myModuleState = useGlobalValue('@my-org/my-module', () => ({ foo: true }));
    const mySymbolState = useGlobalValue(Symbol.for('@my-org/my-module'), () => ({ bar: true }));

    Type parameters

    • Value