Skip to content

Instantly share code, notes, and snippets.

@theKashey
Last active March 4, 2018 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theKashey/16a20e9589c2278aaf6a9f0a1aba48a3 to your computer and use it in GitHub Desktop.
Save theKashey/16a20e9589c2278aaf6a9f0a1aba48a3 to your computer and use it in GitHub Desktop.
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