Skip to content

Instantly share code, notes, and snippets.

@chetanraj
Created August 10, 2020 17:41
Show Gist options
  • Save chetanraj/eba8f04d207599d15630c022f432560e to your computer and use it in GitHub Desktop.
Save chetanraj/eba8f04d207599d15630c022f432560e to your computer and use it in GitHub Desktop.
const Input = () => {
const [name, setName] = useRecoilState(nameStateAtom);
const onChange = (event) => {
setName(event.target.value);
};
return (
<div className="input">
<input placeholder="Enter name" type="text" value={name} onChange={onChange} /><br />
<div className="comment">The state is shared using <a href="https://recoiljs.org/">recoil</a></div>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment