Skip to content
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

精读《zustand 源码》 #392

Closed
ascoders opened this issue Jan 21, 2022 · 3 comments
Closed

精读《zustand 源码》 #392

ascoders opened this issue Jan 21, 2022 · 3 comments

Comments

@ascoders
Copy link
Owner

ascoders commented Jan 21, 2022

zustand 是一个基于 Redux + Context 思想(并不依赖 redux)的数据流管理工具,并暴露 Hooks API,非常时髦,值得学习一下 API 与实现原理。


精读《zustand 源码》

@tangdw
Copy link

tangdw commented Jan 24, 2022

image
"compare 函数" 对比的是 useCallback 返回值(函数)的执行结果,对比是否为 true 不一定

@ascoders
Copy link
Owner Author

image "compare 函数" 对比的是 useCallback 返回值(函数)的执行结果,对比是否为 true 不一定

嗯,这样写更准确,useCallback 返回值就是函数。

@dontry
Copy link

dontry commented May 27, 2023

最近看了最新zustand,现在它用了“React.useSyncExternalStore()"这个hook,连context都省掉了。不过具体这个hook的原理还没看明白

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants