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

看后感 #11

Open
WuYufeng233 opened this issue Dec 15, 2020 · 1 comment
Open

看后感 #11

WuYufeng233 opened this issue Dec 15, 2020 · 1 comment

Comments

@WuYufeng233
Copy link

看了一下自定义 hooks,其中几个不就是 react-use 这个库的吗 = =

@jokingzhang
Copy link
Member

对啊,我就是复制粘贴过来的;
createGlobalState 修改了源码,支持使用回调函数的方式setValue

setState(prevState => {
  // 也可以使用 Object.assign
  return {...prevState, ...updatedValues};
});

其他都一样的~

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

2 participants