Skip to content

Instantly share code, notes, and snippets.

@jaySmilet
Created October 9, 2025 18:49
Show Gist options
  • Select an option

  • Save jaySmilet/7422876d4990717c8ce16daac730ed2f to your computer and use it in GitHub Desktop.

Select an option

Save jaySmilet/7422876d4990717c8ce16daac730ed2f to your computer and use it in GitHub Desktop.
React uncontrolled components
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