Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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]
  };
}
// <===============>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #redux #mapstatetoprops #props
ADD COMMENT
Topic
Name
7+9 =