Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save abdelfattah-atef94/4b6d0f1cba25af419b5b535e3489bf0d to your computer and use it in GitHub Desktop.
Save abdelfattah-atef94/4b6d0f1cba25af419b5b535e3489bf0d to your computer and use it in GitHub Desktop.
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