diff --git a/src/services/providers/language/LanguageProvider.tsx b/src/services/providers/language/LanguageProvider.tsx index 1cc2672..d411311 100644 --- a/src/services/providers/language/LanguageProvider.tsx +++ b/src/services/providers/language/LanguageProvider.tsx @@ -1,4 +1,5 @@ -import React, { ReactNode, useState } from 'react' +import React, { ReactNode } from 'react' +import { useLocalStorage } from '@uidotdev/usehooks' import LanguageContext from './LanguageContext' import en from './data/en.json' @@ -16,7 +17,7 @@ export const LanguageProvider: React.FC = ({ initialLanguage, children, }) => { - const [language, setLanguage] = useState(initialLanguage) + const [language, setLanguage] = useLocalStorage('gps-tools_language', initialLanguage) const toggleLanguage = () => setLanguage((currentState) => (currentState === 'en' ? 'de' : 'en')) const dictionary: LanguageDictionary = { en, de }