refining userContext

This commit is contained in:
Antoine M 2024-02-13 19:23:11 +01:00
parent 29e973a4f1
commit 3b32f6d5af

View File

@ -1,13 +1,6 @@
import { createContext, useState } from "react"; import { createContext, useState } from "react";
export const UserContext = createContext({ export const UserContext = createContext();
language: "fr",
country: "Belgique",
profile: "lhoist_employee",
changeLanguage: () => {},
changeCountry: () => {},
changeProfile: () => {},
});
export function UserContextProvider({ children }) { export function UserContextProvider({ children }) {
const [language, setLanguage] = useState("fr"); const [language, setLanguage] = useState("fr");
@ -31,7 +24,14 @@ export function UserContextProvider({ children }) {
} }
return ( return (
<UserContext.Provider <UserContext.Provider
value={{ language, changeLanguage, country, changeCountry, profile, changeProfile }}> value={{
language,
changeLanguage,
country,
changeCountry,
profile,
changeProfile,
}}>
{children} {children}
</UserContext.Provider> </UserContext.Provider>
); );