Created
February 4, 2019 15:06
-
-
Save tannerlinsley/f83753dc9a60e89ec8f531f9a3d6ae37 to your computer and use it in GitHub Desktop.
This file contains 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
const useMyTodos = () => { | |
const [{ todos, myUserID }] = useStore() | |
// Only update when todos or myUserID updates | |
return useMemo( | |
() => todos.filter(todo => | |
todo.userID === myUserID | |
), | |
[todos, myUserID] | |
) | |
} | |
const App = () => { | |
const todos = useMyTodos() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment