Created
June 8, 2019 21:53
-
-
Save cevr/a6d514bee8f8cebbb7e82ab053d28a61 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
function Todos() { | |
const todos = useStore(state => state.todos); | |
const { toggle, del } = useActions(actions => ({ | |
toggle: actions.toggle, | |
del: actions.delete, | |
})); | |
const todosList = Object.values(todos); | |
return todosList.map(todo => ( | |
<Todo key={todo.id} todo={todo} toggle={toggle} del={del} /> | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment