v0.0.1
This commit is contained in:
27
src/container/App.jsx
Normal file
27
src/container/App.jsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import React, { useReducer, useContext } from 'react';
|
||||
import { usePersistedContext, usePersistedReducer } from '@hook/usePersist';
|
||||
|
||||
import RootContainer from '@container/RootContainer';
|
||||
import RootContext from '@context/RootContext';
|
||||
import RootReducer from '@slice/RootSlice';
|
||||
import Properties from '@constant/Properties';
|
||||
|
||||
const App = () => {
|
||||
const globalStore = usePersistedContext(
|
||||
useContext(RootContext),
|
||||
Properties.STORE_KEY,
|
||||
);
|
||||
|
||||
const [state, dispatch] = usePersistedReducer(
|
||||
useReducer(RootReducer, globalStore),
|
||||
Properties.STORE_KEY,
|
||||
);
|
||||
|
||||
return (
|
||||
<RootContext.Provider value={{ state, dispatch }}>
|
||||
<RootContainer />
|
||||
</RootContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
||||
Reference in New Issue
Block a user