React has detected a change in the order of Hooks
janva255 opened this issue · comments
It happens to me on a conditionally displayed translation for example, when the condition goes from false to true
condition && <Component label={T("translationKey")} />
What I did to fix it is to declare it before using it but i prefer doing it like I showed before
const translation = T("translationKey")
condition && <Component label={translation} />
Hi, yes your solution is the right way to handle conditional rendering with hooks. Talkr only relies on Context, this is why you must comply to the rule of hooks. It could be fixed, but I'd need to use other packages and this would go against the idea of Talkr: having a super-light i18n solution with 0 dependencies.
@DoneDeal0 Ok, if this is the only way then I can close this issue, thanks