2021-09-15 20:16:04 +00:00
|
|
|
import React, { FC } from 'react';
|
2021-08-05 23:30:31 +00:00
|
|
|
import { Provider } from 'react-redux';
|
|
|
|
import { MockStoreEnhanced } from 'redux-mock-store';
|
|
|
|
|
|
|
|
import { RootState } from '../ui/redux/modules';
|
|
|
|
|
2021-09-15 20:16:04 +00:00
|
|
|
// eslint-disable-next-line react/display-name -- There's not a good way to do with a FunctionComponent while also maintaining the display name.
|
2021-12-03 20:08:28 +00:00
|
|
|
export const withReduxStore = (store: MockStoreEnhanced<RootState, {}>, Node?: React.ComponentType): FC => ({ children }) => {
|
|
|
|
return (
|
|
|
|
<Provider store={store}>
|
|
|
|
{Node ? <Node>{children}</Node> : children}
|
|
|
|
</Provider>
|
|
|
|
);
|
|
|
|
};
|