Last active
March 4, 2018 21:03
-
-
Save theKashey/16a20e9589c2278aaf6a9f0a1aba48a3 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 getVisibleTodos = (state, props) => | |
switch (state.visibilityFilter) { | |
case 'SHOW_COMPLETED': return state.todos.filter(todo => todo.completed) | |
case 'SHOW_ACTIVE': return state.todos.filter(todo => !todo.completed) | |
default: return todos | |
} | |
const mapStateToProps = (state, props) => { | |
return { | |
todos: memoize(getVisibleTodos(state, props)) | |
} | |
} | |
const mapStateToProps = memoize( (state, props) => { | |
return { | |
todos: getVisibleTodos(state, props) | |
} | |
}) | |
const mapStateToProps = memoize( (state, props) => { | |
return { | |
todos: memoize(getVisibleTodos(state, props)) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment