refactor(store): use redux instead of easy-peasy

This commit is contained in:
moklick
2021-01-19 13:58:24 +01:00
parent 11f385c4b8
commit e9a7ade236
18 changed files with 10527 additions and 441 deletions
+12 -10
View File
@@ -1,20 +1,22 @@
import React, { FC } from 'react';
import { StoreProvider } from 'easy-peasy';
import { Provider } from 'react-redux';
import store from '../../store';
import { useStore } from '../../store/hooks';
// import { useStore } from '../../store/hooks';
const Wrapper: FC = ({ children }) => {
const easyPeasyStore = useStore();
const isWrapepdWithReactFlowProvider = easyPeasyStore?.getState()?.reactFlowVersion;
// const reactFlowStore = useStore();
// const isWrapepdWithReactFlowProvider = reactFlowStore?.getState()?.reactFlowVersion;
if (isWrapepdWithReactFlowProvider) {
// we need to wrap it with a fragment because t's not allowed for children to be a ReactNode
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051
return <>{children}</>;
}
// console.log(isWrapepdWithReactFlowProvider);
return <StoreProvider store={store}>{children}</StoreProvider>;
// if (isWrapepdWithReactFlowProvider) {
// // we need to wrap it with a fragment because t's not allowed for children to be a ReactNode
// // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051
// return <>{children}</>;
// }
return <Provider store={store}>{children}</Provider>;
};
Wrapper.displayName = 'ReactFlowWrapper';