-
Notifications
You must be signed in to change notification settings - Fork 12
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
createContext 的第二个参数优化更新的用法要被移除了 #4
Comments
这里目前只是为了少点代码,其实想实现这种效果很简单,用 ref 转发一下就够了,我后面改一下 |
你下面那种写法不行的,会破坏 hooks 的限制 |
破坏限制具体指的什么呢?可否赐教一下。 我目前的理解是,只要后面 value 一直不变,就都不会触发 context 的穿透更新。而使用 |
useHook 本质是一个自定义 hook |
看完了,很 nice |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
heo/src/index.tsx
Line 22 in 24893f7
React 有一个 PR ,现在已经把这种用法移除掉了。
可能我想得不够全面,但是感觉这里采用下面的写法就足够了:
The text was updated successfully, but these errors were encountered: