Skip to content

useTranslation hook violates React's rules of hooks by conditionally calling inner hooks #1863

@alespergl

Description

@alespergl

🐛 Bug Report

When useTranslation is called before initReactI18next, it returns early with the "not ready" result object. Later, after the init function gets called, the hook continues past that early return and calls other hooks (e.g. useState) which it didn't call before.

This behaviour is in violation of React's rules of hooks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions