I may be missing something, but I can\'t find any example where connect()
wraps a component defined as a class (extending React.Component
), it always
You can wrap a React component, whether it's a class or a functional component, with react-redux connect
.
class MyDiv extends React.Component {
render() {
return <div>hi</div>
}
}
export default connect(({ stateStuff }) => ({ stateStuff }))(MyDiv);
you actually are correctly wrapping your component class in connect()
. Your problem is elsewhere, in routes/Home/index.js:
import HomeContainer from './containers/HomeContainer'
export default (store) => {
component : HomeContainer(store)
}
the default export of HomeContainer
is the higher-order class returned by connect. You're then trying to use HomeContainer
as a function here, just like your console error says:
HomeContainer(store)
.