When I use
handleChange(newValue) {
this.setState({content: newValue});
}
it fails. Two change events are fired, one with the character typed, and the consecutive one with an empty string. But, interestingly, if I do this, it works.
handleChange(newValue) {
console.log(newValue);
}
So, how do I get the value stored in the Ace editor ?
If you add a ref when you render the component, eg:
<AceEditor
ref="ace"
...
/>
Then you can later access the entire content using:
this.refs.ace.editor.getValue();
Ah! Cool. Din't strike my mind even though I saw this.editor being used in the code.
Thanks!
Most helpful comment
If you add a ref when you render the component, eg:
Then you can later access the entire content using: