Hi,
Please tell me how I can call the “state” of the first component(Editor) into the second one(Previewer)? so that the Previewer changes as I type into the Editor.
https://codepen.io/Supreme-Sage/pen/gOWWqVP
Hi,
Please tell me how I can call the “state” of the first component(Editor) into the second one(Previewer)? so that the Previewer changes as I type into the Editor.
https://codepen.io/Supreme-Sage/pen/gOWWqVP
If previewer is a child of editor you can pass down state of previewer to the child editor through props, it will cause a rerender whenver state or props change.
Another way you can do it is if they are siblings, then you will raise the state of editor to a parent i.e. App component for example and they both can share it.