jsx ref code example
Example 1: refs react js
class Lesson9Refs extends Component {
onAddProduct = () => {
alert(this.refs.productname.value);
}
return (
Featured
{ elements }
);
}
}
export default Lesson9Refs;
Example 2: react ref
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.myRef = React.createRef(); }
render() {
return ; }
}