connectWithReduxStore.tsx 367 B

1234567891011
  1. import React from 'react';
  2. import { connect } from 'react-redux';
  3. import { store } from '../../store/store';
  4. export function connectWithStore(WrappedComponent: any, ...args: any[]) {
  5. const ConnectedWrappedComponent = (connect as any)(...args)(WrappedComponent);
  6. return (props: any) => {
  7. return <ConnectedWrappedComponent {...props} store={store} />;
  8. };
  9. }