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

Why child components would be rerendered when I18n got texts by XHR ? #111

Open
zhangyugege opened this issue Mar 25, 2020 · 0 comments
Open

Comments

@zhangyugege
Copy link

Hello~ I am a beginner.

I am studying this great project.

I have a question about some details of this project.

Source code at here: https://github.com/manuelbieh/react-ssr-setup/blob/master/src/shared/i18n/IntlProvider.tsx#L46

import i18nextXHRBackend from 'i18next-xhr-backend';
// ...
const I18N: React.FC<any> = ({ children }) => {
    const locale = useSelector(getLocale);
    useEffect(() => {
        i18next.changeLanguage(locale);
    }, [locale]);

    return <I18nextProvider i18n={i18next}>{children}</I18nextProvider>;
};

My question is why children will rerender when i18nextXHRBackend got texts from backend?
I am trying to create a project by myself without I18nextProvider and redux, and my child component couldn't rerender, and only render once before xhr got texts.:robot::see_no_evil:

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

1 participant