1function FormValidation(props) {
2 let inputValue = React.createRef();
3
4 let handleSubmit = e => {
5 alert(`Input value: ${inputValue.current.value}`);
6 e.preventDefault();
7 };
8
9 return (
10 <div>
11 <form onSubmit={handleSubmit}>
12 <input type="text" ref={inputValue} />
13 <button type="submit">Submit</button>
14 </form>
15 </div>
16 );
17}
18