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

setVariablesEditorValue() function

Programmatically sets the current value of a variables editor after it has already initialized and become an uncontrolled component. Passing the editorRef prop to the component will give a reference to editor, or use ControlledValuePlugin to manage this automatically.

If newValue is undefined, the editor will be set to an empty state. If newValue is a string, it will be treated as a variable-reference-containing string, and parsed to a Lexical AST If newValue is a serialized Lexical AST, it will be used as-is. If the AST is invalid, the editor will be set to an empty state.

Signature:

Parameters

<table><thead><tr><th>

Parameter

</th><th>

Type

</th><th>

Description

</th></tr></thead> <tbody><tr><td>

editor

</td><td>

LexicalEditor

</td><td>

</td></tr> <tr><td>

newValue

</td><td>

string | undefined | SerializedEditorState<SerializedLexicalNode>

</td><td>

</td></tr> </tbody></table> Returns:

void