Redux MapStateToprops obtient des accessoires
// ParentComponent.js
// ... other component methods ...
render() {
return <TodoContainer id="1" />
}
// TodoContainer.js
// <===============>
// `ownProps` variable contains own component props
function mapStateToProps(state, ownProps) {
return {
todo: state.todos[ownProps.id]
};
}
// <===============>
Thoughtful Turkey