JSFiddle - React, Tailwind, and code Playground
by shriek
HTML
<div id="app">
</div>
JavaScript
class MyForm extends React.Component {
constructor(){
super();
this.state = {
query: ''
};
this.getData = this.getData.bind(this);
}
getData(){
var val = this.state.query;
setTimeout(function(){
console.log(val.value);
});
}
render(){
return (<div>
<input type="search" ref={function(ref){ console.log(this); this.state.query = ref; } onChange={this.getData}}/>
</div>);
}
}
ReactDOM.render(<MyForm/>, document.querySelector('#app'));