/ src / frontend / pages / hooks / themeHook.tsx
themeHook.tsx
 1  import { useState } from "react";
 2  import { useAppDispatch, useAppSelector } from "../../redux/Store";
 3  import { setTheme } from "../../redux/auth/AuthReducer";
 4  
 5  export const ThemeHook = () => {
 6    const dispatch = useAppDispatch();
 7    const [themeOpen, setThemeOpen] = useState(false);
 8  
 9    const { theme } = useAppSelector((state) => state.auth);
10  
11    const changeTheme = (value: string) => dispatch(setTheme(value));
12  
13    return { theme, changeTheme, themeOpen, setThemeOpen };
14  };