1// Using the useRef() hook. Only possible when you're using a function component.
2const App = () => {
3 const textRef = useRef();
4 const showRefContent = () => {
5 console.log(textRef.current.value);
6 };
7 return (
8 <div className="App">
9 <TextField inputRef={textRef} />
10 <button onClick={showRefContent}>Click</button>
11 </div>
12 );
13}
14