onSelectionChange(e) { const { selectionStart, selectionEnd, value } = e.target; this.setState( { selStart: selectionStart, selEnd: selectionEnd, selValue: value.substring(selectionStart, selectionEnd), }, () => { console.log('this.state.selStart'); console.log(this.state.selStart); }, ); } {this.inputRef = ref;}} />