react add ref to component 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: cre&atRefs react js
const node = this.myRef.current;