diff --git a/client/src/common/contexts/View/ViewContext.jsx b/client/src/common/contexts/View/ViewContext.jsx new file mode 100644 index 00000000..a5a7f5a6 --- /dev/null +++ b/client/src/common/contexts/View/ViewContext.jsx @@ -0,0 +1,18 @@ +import React, {useState, createContext} from "react"; + +export const ViewContext = createContext({}); + +export const ViewProvider = (props) => { + const [view, setView] = useState(parseInt(localStorage.getItem("view")) || 0); + + const updateView = (newView) => { + setView(newView); + localStorage.setItem("view", newView); + } + + return ( + + {props.children} + + ) +} \ No newline at end of file