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

[REQUEST] useSelections能否直接传入useState返回的值/暴露操作方法 #2574

Open
xmsz-stu opened this issue Jun 20, 2024 · 0 comments

Comments

@xmsz-stu
Copy link

背景

  • 有个const [state, setState] = useControllableValue({onChange})
  • 涉及选择操作
  • 现在useSelections只能把state传进去,但是setState没办法传,这就导致我改了state,但是没办法通知外部组件
  • 如果在写个useEffect(() => {onChange(selected)}, [selected]);又非常麻烦和奇怪

所以希望能否

  1. 支持把 useSelections(useControllableValue({onChange})) 这种写法和能力,这样写起来就很简单
  2. 或者暴露出里面操作方法,变成 withMethods(useControllableValue({onChange})), 这样也比较方便
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

1 participant