Created
October 9, 2025 18:49
-
-
Save jaySmilet/7422876d4990717c8ce16daac730ed2f to your computer and use it in GitHub Desktop.
React uncontrolled components
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useRef } from "react"; | |
| function EmailInput() { | |
| const inputRef = useRef(); | |
| function handleSubmit() { | |
| alert(inputRef.current.value); | |
| } | |
| return ( | |
| <> | |
| <input ref={inputRef} /> | |
| <button onClick={handleSubmit}>Submit</button> | |
| </> | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment