Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract Logic Into Own Hook #71

Closed
mircealungu opened this issue Jun 24, 2021 · 0 comments
Closed

Extract Logic Into Own Hook #71

mircealungu opened this issue Jun 24, 2021 · 0 comments
Assignees

Comments

@mircealungu
Copy link
Member

mircealungu commented Jun 24, 2021

Could this be the first specialized hook from Zeeguu-React? :)

import LandingPage from "./landingPage/LandingPage";
@@ -28,13 +28,25 @@ function App() {

  const [uiLanguage, setUiLanguage] = useState(LocalStorage.getUiLanguage());

  useEffect(() => {
    const uiLang = LocalStorage.getUiLanguage();
    if (uiLang === undefined) {
      LocalStorage.setUiLanguage({ code: "en" });
    }
    setUiLanguage(uiLang);
  }, []);

  useEffect(() => {
    if (uiLanguage !== undefined) strings.setLanguage(uiLanguage.code);
  }, [uiLanguage]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants