setState in onChange will block the editor
See original GitHub issue onChange(newValue) {
this.setState({ code: newValue });
console.log('change', this.state.code);
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:13
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Calling setAttributes() in Gutenberg Block causes bad setState ...
This is the first time I have attempted to use setAttributes() outside of an onChange property in another component/block. The attribute name is...
Read more >Using AceEditor in React - Medium
I was frustrated when using setState in AceEditor's onchange causes anything typed in the editor to not show at all — see the...
Read more >React conditional rendering: 9 methods with examples
In this tutorial, we'll cover the most popular ways to implement conditional rendering in React, also reviewing some tips and best practices. To ......
Read more >Updating Objects in State - React Docs
State can hold any kind of JavaScript value, including objects. But you shouldn't change objects that you hold in the React state directly....
Read more >How to Edit Todos Items in a React Application | Ibaslogic
We will change this to true using the setState() method once we double click any of the items. We will also use the...
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
@mbrochstein I was able to find a workaround by using Reacts shouldComponentUpdate method.
Then for my onChange method for the <AceEditor />
This will update the state of aceEditorValue with whatever is entered into the editor without re-rendering the entire component. Works for my use case.
Well, this is a huge bug and it is still there. I tried to use
react-ace
with https://github.com/jaredpalmer/formik and behaviour is the same, it just stucks.upd This looks not nice, but it worked out for me. The key issue, as I understand, is that you better not set state or do anything with the value right from the ace’s
onChange
(inline). You better do it in the different component’s function.