Untitled
8 months ago in JavaScript
import React, { createContext, useState } from 'react';
//Création du contexte
export const ThemeContext = createContext();
//Provider du contexte
const ThemeProvider = ({children}) => {
//par défault, le theme est sur light
const [theme,setTheme] = useState("light");
return (
<ThemeContext.Provider value={{theme, setTheme}}>
{children}
</ThemeContext.Provider>
);
};
export default ThemeProvider;