-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Hello, I would have opened this in discussions, but it is not enabled, so it is less of an 'issue' and more of a 'discussion'
https://stackoverflow.com/questions/62555916/how-to-pass-store-to-the-sub-component-in-react-redux
https://stackoverflow.com/questions/52857738/mapstatetoprops-for-functional-component
Any idea how to use this in a sub component, from the above links, I could have done something like this in react-redux. Still learning how to use these methods here!
import { connect } from 'react-redux';
class MyComponent extends React.Component {
constructor(props) {
super(props);
console.log(this.props.name);
}
...
}
const mapStateToProps = (store) => {
// console.log('store', store);
return {
name: store.<reducer>.name,
};
};
export default connect(mapStateToProps, null)(MyComponent);
Metadata
Metadata
Assignees
Labels
No labels