-
Notifications
You must be signed in to change notification settings - Fork 194
Closed
Labels
Description
value parameter seems to always be null in onBeforeChange(editor,_ data, value, next) for an uncontrolled codemirror ; did I miss something ?
import React, { Component } from 'react';
import { UnControlled as CodeMirror } from 'react-codemirror2';
class App extends Component {
handleBeforeChange = (editor, data, value, next) => {
console.log('handleBeforeChange', value); // gets null
next();
};
handleChange = (editor, data, value) => {
console.log('handleChange', value); // gets the field value
};
render() {
return (
<div className="App">
<CodeMirror
onChange={this.handleChange}
onBeforeChange={this.handleBeforeChange}
/>
</div>
);
}
}
export default App;