Editor mount causing react warning "Warning: Cannot update a component from inside the function body of a different component."
See original GitHub issueLikely due to more recent version of react throwing the warning. As discussed here, (https://github.com/facebook/react/issues/18178) the warning is new and will eventually be a hard exception. I believe the problem comes from this line https://github.com/draft-js-plugins/draft-js-plugins/blob/master/draft-js-plugins-editor/src/Editor/index.js#L74 when onChange
callback results in a setState
call, resulting in attempt to render the Editor component within its own onMount hook. I suspect this line didn’t work as intended and now the warning brings it to light.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:12
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Cannot update a component from inside the function body of a ...
If you call setState during a render on a different component, you will now see a warning: Warning: Cannot update a component from...
Read more >Bug: too hard to fix "Cannot update a component from inside ...
React 16.13.0 'Warning: Cannot update a component from inside the function body of a different component.' urql-graphql/urql#600.
Read more >warning: cannot update a component - You.com | The Search ...
It is happening because useEffect runs after the component is rendered. So what's happening in this case is that your Outlet component is...
Read more >How to fix the "cannot update a component while rendering a ...
A quick guide to how I solved a confusing React error.
Read more >Hooks FAQ - React
You can't use Hooks inside a class component, but you can definitely mix classes and function components with Hooks in a single tree....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lciii Yes its not a react issue. It just surfaced more recently since react started warning about the issue in the plugin that already existed. I’ve outlined the specific problem in my original post.
Still error 😦( I’m using hook component.
const [editorState, setEditorState] = useState( EditorState.createEmpty(decorator), );
Error when use decorator @@