How to read the external text change events in react.
The extensions like Grammarly and Auto Text Expander update the text inside textarea, but no react onChange or onInput event is fired after the change. As the result, state is not updated and the condition is inconsistent (different values in textarea and component's state). One way is to read the dom value on submit, but that's not the perfect solution for my scenario, as some other actions depends on the current value of the textarea. Any good solution?
PS: I'm asking for a generic solution. Changing extensions code is not an option.
I checked this and it works fine for me. Spelling and grammar corrected by Grammarly updates the component state.
<textarea value={this.state.testText} onChange={(e) => {this.setState({testText: e.target.value} )}} />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With