DEV Community

DeChamp
DeChamp

Posted on

TypeError: Invalid attempt to destructure non-iterable instance.

Hello!

Have you seen a similar error before?

TypeError: Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method

Chance are that you need to make sure the component using the react context, is actually a child (any level deep) of the component that sets the context.

It seems to related to when the usage is outside of the initialization.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay