add sidebar with redux
- add store - add routes - add page wrapper, mainlayout - add nav folder
This commit is contained in:
19
src/components/PageWrapper.js
Normal file
19
src/components/PageWrapper.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useEffect } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { setAppState } from "../store/appStateSlice";
|
||||
|
||||
const PageWrapper = (props) => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
useEffect(() => {
|
||||
if (props.state) {
|
||||
dispatch(setAppState(props.state));
|
||||
}
|
||||
}, [dispatch, props]);
|
||||
|
||||
return (
|
||||
<>{props.children}</>
|
||||
);
|
||||
};
|
||||
|
||||
export default PageWrapper;
|
||||
Reference in New Issue
Block a user