i'm new in reactjs. i was reading a documentation how to get an input value. But i'm still getting an undefine error. This is what i did.
class Test extends React.Component{
constructor(props){
super(props)
this.inputRef = React.createRef()
}
clickHandler(){
console.log(this.inputRef)
}
render(){
return(
<div>
<input type="text" ref={this.inputRef}/>
<button onClick={this.clickHandler}>click Me</button>
</div>
)
}
}
ReactDOM.render(<Test />, document.getElementById('root'));