Skip to main content

Module: @lexical/react/useLexicalSubscription

Type Aliases

LexicalSubscription

Ƭ LexicalSubscription<T>: Object

Type parameters

Name
T

Type declaration

NameType
initialValueFn() => T
subscribe(callback: (value: T) => void) => () => void

Defined in

packages/lexical-react/src/useLexicalSubscription.tsx:15

Functions

useLexicalSubscription

useLexicalSubscription<T>(subscription): T

Shortcut to Lexical subscriptions when values are used for render.

Type parameters

Name
T

Parameters

NameTypeDescription
subscription(editor: LexicalEditor) => LexicalSubscription<T>The function to create the LexicalSubscription. This function's identity must be stable (e.g. defined at module scope or with useCallback).

Returns

T

Defined in

packages/lexical-react/src/useLexicalSubscription.tsx:24