Home > @uniformdev/mesh-sdk-react > ControlledValuePlugin

ControlledValuePlugin() function

Updates the Lexical editor state automatically when a controlled value changes, effectively turning the Lexical editor into a controlled component.

DO NOT USE THIS when actually editing with Lexical as it will cause performance problems. This is intended to be used: * To simplify a read-only "preview" editor, where the user can't edit the value * To sync an external state with the Lexical editor state under certain conditions (i.e. composer mounted, but editor hidden)

Signature:

Parameters

ParameterTypeDescription
{ enabled, value, extraDependencies, }{ enabled: boolean; value: string | undefined | SerializedEditorState<SerializedLexicalNode>; extraDependencies?: unknown[]; }

Returns:

JSX.Element | null