Skip to content

Instantly share code, notes, and snippets.

@itzzmeakhi
Created January 11, 2022 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itzzmeakhi/6c5247fe93e7807c37d3ecb1a4556ff8 to your computer and use it in GitHub Desktop.
Save itzzmeakhi/6c5247fe93e7807c37d3ecb1a4556ff8 to your computer and use it in GitHub Desktop.
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