Skip to content

Instantly share code, notes, and snippets.

@techomoro
Created November 13, 2021 04:49
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 techomoro/739d459ad92dbca8241607955654a2d9 to your computer and use it in GitHub Desktop.
Save techomoro/739d459ad92dbca8241607955654a2d9 to your computer and use it in GitHub Desktop.
import React from "react";
import { useRecoilState } from "recoil";
import { nameState } from "../atoms/name";
export default function InputComponent() {
const [name, setName] = useRecoilState(nameState);
let handleChangeInput = (e) => {
setName(e.target.value);
};
return (
<input
type="text"
placeholder="Enter the string"
onChange={handleChangeInput}
value={name}
/>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment