redux mapstatetoprops get props
// 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]
};
}
// <===============>