Created
February 8, 2019 00:23
-
-
Save ctrlplusb/fe1d85937941798f495476f9904260e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function Todos() { | |
const items = useStore(state => state.todos.items); | |
// 👇 | |
const save = useActions(actions => actions.todos.save); | |
const [newTodo, setNewTodo] = useState(""); | |
return ( | |
<div> | |
... | |
<button onClick={() => save(newTodo)}>Add</button> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment