Skip to content

Instantly share code, notes, and snippets.

@chentsulin
Last active November 5, 2018 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chentsulin/6ab99b9434c86ebaeed08004310fe12a to your computer and use it in GitHub Desktop.
Save chentsulin/6ab99b9434c86ebaeed08004310fe12a to your computer and use it in GitHub Desktop.
hooks-useState
const App = () => {
const [name, setName] = useState('');
const [email, setEmail] = useState('');
const handleNameChange = event => {
setName(event.target.value);
};
const handleEmailChange = event => {
setEmail(event.target.value);
};
return (
<>
<input value={name} onChange={handleNameChange} />
<input value={email} onChange={handleEmailChange} />
</>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment