-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
有考虑针对这样的场景进行优化吗 #6
Comments
要实现得深层遍历 proxy,目前不考虑这样的方式。 https://zhuanlan.zhihu.com/p/468417292 "6. resso 的使用方式" 中有解释 本文中情形可以这么写,保证最后有一次重新赋值就行: store.count.a.b.c += 1;
store.count = { ...store.count }; |
嗯,但是我这个demo,proxy就算只监听一层应该还是能监听到数据变化的,我看了你的源码,这个demo没有触发重渲染应该是在后续的useState的setValue上面。我是挺喜欢你这样的极简设计的,代码量也很少,值得学习,但是用起来感觉还是有限制的,有空我fork下自己研究一下吧 |
监听一层不会的,无论是 MobX 还是 valtio,都需要深层递归去监听。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Demo在这里:https://codesandbox.io/s/resso-forked-1mbs58?file=/src/App.jsx
我觉得这样的场景是可能存在的,当使用resso时对象操作的层级比较深时,又想同时进行相应的视图更新的时候会比较麻烦
The text was updated successfully, but these errors were encountered: