I have this
const CompA = () => {
let _input;
return (
<input ref={el => _input = el} type="text" />
);
}
And this
const CompB = () => {
const _input = useRef(null);
return (
<input ref={_input} type="text" />
);
}
Two _input is the ref object of the input tag and I can't find the differences between them.
My question is: What are the differences between two _input and which _input is better?