Problem: You want to access some React state outside of React, in plain JS/TS


Problem: You want to access some React state outside of React, in plain JS/TS.

Solution: Move the state out of React. Put it in Zustand instead.

Zustand makes it easy to access state both inside and outside React. It's kinda like Redux, but MUCH simpler.

View original on X