Created
February 19, 2016 21:10
-
-
Save thomasboyt/550ed7949d4e4644ce2e 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
// How to pass arbitrary arguments to reselect selectors (I think?) | |
// arbitrary selector to capitalize a todo's name for... some reason | |
// memoized based on the todo object | |
const selector = createSelector( | |
(state, props) => state.todos.get(props.id), | |
(todo) => todo.title.toUpperCase() | |
); | |
const TodoTitle = React.createClass({ | |
propTypes: { | |
todoId: React.PropTypes.number.isRequired, | |
}, | |
render() { | |
return this.props.title; | |
} | |
}); | |
function select(state, props) { | |
return { | |
title: selector(state, { | |
id: props.todoId | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment