What are refs in React? When should they be used?
Answer
class MyComponent extends React.Component {
constructor(props) {
super(props)
this.myRef = React.createRef()
}
render() {
return <div ref={this.myRef} />
}
}Good to hear
Additional links
Previouscross-site scripting attack (XSS) and how do you prevent it?Nextvirtual DOM and why is it used in libraries/frameworks?
Last updated