ISSUE-011 - Hooked up Redux. Switched to using embedded route. Using central store to keep track of menu height information. Refactored fullscreen calculations.
This commit is contained in:
1 parent
3add2f3237
commit
f3e4ac318c
5 files changed
+34
-12
No files matched your search
+14
-1
@@ -1,11 +1,24 @@
|
||||
import { Outlet } from "react-router-dom";
|
||||
|
||||
import { useDimensions } from "./utils/hooks";
|
||||
import { setMenuDimensions } from "./features/pageDimensions/pageDimensionsSlice";
|
||||
|
||||
import { MainMenu } from "./components/Menu";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useEffect } from "react";
|
||||
|
||||
function App() {
|
||||
const dispatch = useDispatch();
|
||||
const [ref, { height }] = useDimensions<HTMLDivElement>();
|
||||
|
||||
useEffect(() => {
|
||||
// Make sure to not dispatch during a render.
|
||||
dispatch(setMenuDimensions({ height }));
|
||||
}, [height]);
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
<MainMenu />
|
||||
<MainMenu ref={ref} />
|
||||
<Outlet />
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user