pmndrs / zustand

🐻 Bear necessities for state management in React

Home Page:https://zustand-demo.pmnd.rs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Putting dom reference into store will cause lag

MilesLeeeeee opened this issue · comments

Summary

Hello
I tried putting the dom reference into the store to make it easier for me to use, but I found that it made the browser lag.

I tested in three browsers

chrome:117
edge:117
firefox:116

Chrome and edge are experiencing serious lags

firefox runs fine

Is there something wrong with my operation or should I not put the dom reference into the store?

Link to reproduction

https://codesandbox.io/s/zustand-dom-test-d7g4l3?file=/src/App.js

You can see the difference by changing the comment on this line

image