I was trying to create some components in the same jsx file. I wants to connect one of the child component to store(feels wrong here), without connecting the HOC component to the store. Therefore when connecting the child component he does not use export default connect. It creates an error saying actions are undefined.
Example code.
class Test1 extends React.Component {
constructor(props) {
****
}
render(){
****
}
}
function mapActionsToProps(dispatch) {
return {
actions: {
testAction: bindActionCreators(testActionFromActions, dispatch)
}
}
connect(mapStateToProps,mapActionsToProps) (Test1);
class Test2 extends React.Component {
constructor(props){
***
}
render(){
return (<Test1/>);
}
}
export default Test2;
My question is why we always need to use connect as export default connect ?. Is there any other ways to do the connect?.
Thank you in advance.