Skip to content

Instantly share code, notes, and snippets.

@ozcanzaferayan
Created May 19, 2020 14:14
Show Gist options
  • Save ozcanzaferayan/fe66179a4b6af8820c41e580d4f3843e to your computer and use it in GitHub Desktop.
Save ozcanzaferayan/fe66179a4b6af8820c41e580d4f3843e to your computer and use it in GitHub Desktop.
import React from "react";
import { useRecoilValue, atom } from "recoil";
const todoListState = atom({
key: "todoListState",
default: ["Apples", "Eggs", "Butter"],
});
function App() {
const todoList = useRecoilValue(todoListState);
return (
<>
{todoList.map((item) => (
<li key={item}>{item}</li>
))}
</>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment