-
-
Save itzzmeakhi/6c5247fe93e7807c37d3ecb1a4556ff8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { store } from './redux/store'; | |
const connectFn = (mapStateToProps, mapDispatchToProps) => { | |
return (WrappedComponent) => { | |
return class extends Component { | |
render() { | |
console.log(this.props) | |
return ( | |
<WrappedComponent | |
{...this.props} | |
{...mapStateToProps(store.getState(), this.props)} | |
{...mapDispatchToProps(store.dispatch, this.props)} | |
/> | |
); | |
} | |
} | |
} | |
} | |
export { connectFn }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment