19 lines
391 B
JavaScript
19 lines
391 B
JavaScript
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; |