Skip to content

Commit

Permalink
Fix conditional usage of hooks error
Browse files Browse the repository at this point in the history
  • Loading branch information
imbhargav5 committed Sep 26, 2019
1 parent 6399373 commit a492192
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/useSSR.js
Expand Up @@ -3,7 +3,8 @@ import { getI18n, getHasUsedI18nextProvider, I18nContext } from './context';

export function useSSR(initialI18nStore, initialLanguage, props = {}) {
const { i18n: i18nFromProps } = props;
const { i18n: i18nFromContext } = getHasUsedI18nextProvider() ? useContext(I18nContext) : {};
const ReactI18nContext = useContext(I18nContext);
const { i18n: i18nFromContext } = getHasUsedI18nextProvider() ? ReactI18nContext : {};
const i18n = i18nFromProps || i18nFromContext || getI18n();

// opt out if is a cloned instance, eg. created by i18next-express-middleware on request
Expand Down

0 comments on commit a492192

Please sign in to comment.