DEV Community

Luca Dorigo
Luca Dorigo

Posted on

React state is being shared across iframes?

We have a next.js app that we normally run by embedding it in an iframe on a third-party website. It uses react and react-query for state management. For a specific usecase, we wanted to run two instances of our app on the same website, and noticed very weird behavior: the state of the two apps is getting jumbled together, and state changes in one iframe sometimes (not always) result in a state change in the other iframe. I wish I could give more details on when/how it happens, but I'm pretty confused by the issue and haven't been able to create a minimal reproducible example. Hopefully someone has an idea to help me troubleshoot?

Top comments (0)