Skip to content

Vizel API / react/src / useVizelContextSafe

Function: useVizelContextSafe()

ts
function useVizelContextSafe(): Editor | null;

Defined in: packages/react/src/components/VizelContext.tsx:77

Hook to access the editor instance from context.

Returns null both when used outside of a provider and when the provider has not yet produced an editor instance. The two cases are indistinguishable by design — callers that need to render conditionally should treat null uniformly as "no editor available". Use useVizelContext when the absence of a provider is a programming error.

Returns

Editor | null

Released under the MIT License.