- Avoid state duplication. Instead, derive from props by transforming the
state
andownProps
inmapStateToProps
. Example:
// This example assumes the same data structure as suggested below:
function mapStateToProps(reduxState, ownProps) {
// ownProps = props passed to this component (some come from React router.)
const { id } = ownProps.match.params
const { lists } = state;