How to create ref and access the ref in es7.
class SomeComponent extends Component {
state = {
count: 0,
this.myRef = React.createRef() //error
myRef: React.createRef(), // Unused state field: 'myRef'
}
render() {
return <div ref={this.myRef} />; //error
<div ref={myRef} /> // error 'myRef' is not defined
}
}