Open invious opened 4 years ago
useState
sets an initial state, and setEditorState
changes it right after.
State change causes the component to re-render, and once it is rendered again, the state is changed again putting it in an infinite re-render loop.
You need to use useEffect
to make sure your state change runs before the component is mounted. preventing another render.
the setEditorState is causing this error: