Error: Should have a queue. This is likely a bug in React. Please file an issue - useTranslation

Viewed 51

I want to use i18n react useTranslation hook inside Context component. I guess that important thing is that the context was working correctly as long as useTranslation hook was used inside if statement which breaks the rules of hooks and sonarcloud mark this as A rate bug. But as I moved useTranslation call on the very top of the component I get following error:

Error: Should have a queue. This is likely a bug in React. Please file an issue.

And this inside console

The context and project itself is quite large so I am not sure how to provide enough code to present the problem.

1 Answers

As it turned out someone working on the project in the past didn't wrap LocaleContext over the Context I was struggling to repair so in my case all I had to do was following slight change from this:

<MyContext>
  </LocaleContext>
    <Component />
  </LocaleContext>
</MyContext>

to this:

<LocaleContext>
  <MyContext>
    <Component />
  </MyContext>
</LocaleContext>
Related