Function createSafeContextHook

  • Create a context consumer hook for contexts that are nullish by default

    Type Parameters

    • Value

    Parameters

    • context: Context<undefined | Value>

      what you get by calling React.createContext

    • displayName: string = ...

      override the displayName for use in dev tools and the thrown error message

    Returns (() => Value)

    the context value with the nullish type removed

      • (): Value
      • Returns Value

Generated using TypeDoc