Skip to main content

useTranslationsState

useTranslationsState is a hook that takes the translationsContext as input and allows access to the TranslationsContext State.

function App() {  const { isLoading } = useTranslationsState(translationsContext);
  if (isLoading) return null;
  return (    <div className="App">        {...}    </div>  );}

Here is all the information you can access with this hook:

  • isLoading: indicates whether the translation strings are loading;
  • error: indicates whether an error has occurred and what type of error;
  • languages: indicates which languages are supported;
  • currentLanguage: indicates the language currently set.