Answer the question
In order to leave comments, you need to log in
How (where) to save the state value of the component after page reload (Gutenberg, React)?
Hello.
I am writing a block for Gutenberg (an editor for WordPress), the essence of which is as follows:
The interface is just a drop-down list with a value loaded by ajax (in componentDidMount)
After saving the post, it is rendered into a block like
<span>Hello, {this.props.attributes.selectedOptionValue} </span>
state
, then pass it to the child component and do render there. <select>
not lost. And this means that I need to store the value for the current block somewhere. <select value="here">
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question