2018-10-23 09:00:04 -05:00
|
|
|
import React from 'react';
|
2020-03-03 01:22:26 -06:00
|
|
|
import { connect, Provider } from 'react-redux';
|
2018-11-05 09:54:48 -06:00
|
|
|
import { store } from '../../store/store';
|
2018-10-23 09:00:04 -05:00
|
|
|
|
2019-08-01 07:38:34 -05:00
|
|
|
export function connectWithStore(WrappedComponent: any, ...args: any[]) {
|
2019-05-13 02:38:19 -05:00
|
|
|
const ConnectedWrappedComponent = (connect as any)(...args)(WrappedComponent);
|
2018-10-23 09:00:04 -05:00
|
|
|
|
2020-12-01 09:19:52 -06:00
|
|
|
// eslint-disable-next-line react/display-name
|
2019-08-01 07:38:34 -05:00
|
|
|
return (props: any) => {
|
2018-10-23 09:00:04 -05:00
|
|
|
return <ConnectedWrappedComponent {...props} store={store} />;
|
|
|
|
};
|
|
|
|
}
|
2020-03-03 01:22:26 -06:00
|
|
|
|
|
|
|
export function connectWithProvider(WrappedComponent: any, ...args: any[]) {
|
|
|
|
const ConnectedWrappedComponent = (connect as any)(...args)(WrappedComponent);
|
2020-12-01 09:19:52 -06:00
|
|
|
|
|
|
|
// eslint-disable-next-line react/display-name
|
2020-03-03 01:22:26 -06:00
|
|
|
return (props: any) => {
|
|
|
|
return (
|
|
|
|
<Provider store={store}>
|
|
|
|
<ConnectedWrappedComponent {...props} store={store} />
|
|
|
|
</Provider>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
}
|