textfield ref react code example
Example: useref material ui
// Using the useRef() hook. Only possible when you're using a function component.
const App = () => {
const textRef = useRef();
const showRefContent = () => {
console.log(textRef.current.value);
};
return (
<div className="App">
<TextField inputRef={textRef} />
<button onClick={showRefContent}>Click</button>
</div>
);
}