Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save abdelfattah-atef94/0074b39feec94a8724786dd28f7c55b5 to your computer and use it in GitHub Desktop.
Save abdelfattah-atef94/0074b39feec94a8724786dd28f7c55b5 to your computer and use it in GitHub Desktop.
uncontrolled component example
import React, { useRef } from "react";
export default function App() {
const inputRef = useRef(null);
const handleSubmitButton = () => {
alert(inputRef.current.value);
};
return (
<div className="App">
<input type="text" ref={inputRef} />
<input type="submit" value="submit" onClick={handleSubmitButton} />
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment