function App() {
const inputRef = useRef();
const [inputValue, setInputValue] = useState("");
const handleSubmit = (e) => {
e.preventDefault();
setInputValue(inputRef.current.value);
};
return (
<form onSubmit={handleSubmit}>
<h1>{inputValue}</h1>
<TextInput ref={inputRef} />
<button type="submit">Submit</button>
</form>
);
}
export default App;