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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs