Omnistac / zedux

:zap: A Molecular State Engine for React
https://Omnistac.github.io/zedux/
MIT License
344 stars 7 forks source link

fix(react): fix multiple renderers cross-window React warning #72

Closed bowheart closed 1 year ago

bowheart commented 1 year ago

Description

React complains about the same React context object being used by multiple "renderers" (react-dom instances in this case) when Zedux shares context objects across windows in multi-window setups. Instead, create a different context object for each instance of React that Zedux runs in. Use the React instance's createContext function to key a WeakMap mapped to the record of cached context objects.