Imagine the following scenario:
class Input extends React.Component {
render() {
return <input value="123" />
}
}
function App() {
const inputRef = React.useRef();
return (
<Input ref={inputRef} />
);
}
I want to access the input tag's value attribute in my App component.
However, inputRef.current.value is undefined.
How can I access attributes of a class component in React?