We have a component which needs access to Redux's store.
import React from 'react'
import { connect } from 'react-redux'
const Component = (props) => {
... code ...
}
We've connected this componet to the store using connect.
export default connect(mapStateToProps)(Component)
We now need to define mapStateToProps to pass as the first argument to connect.
const mapStateToProps = state => ({ ...state })
Why or why not is this an acceptable approach to injecting the data into the component? Would this make this component rerender in every situation that triggers a render?
Documentation and examples welcome.
FYI: I'm doing it for the second part of this video and considering listing it as the final solution. Would love to know Stack's thoughts on this code.