-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
讨论:components 是否传入 dispatch #29
Comments
第二种更规范优雅,但个人倾向第一种,简单实用。 |
主要是在教程里面需要说一下组件设计的思路,要不两种都介绍一下,然后要用那种,自己选 |
|
教程里按第二种吧 ( @afc163 描述的那个) ,规范一些。 |
建议让开发者自己决定,这种相对细节的实现开发团队统一就好了。 我个人倾向第二种,方法多了在传给组件的时候,可以用解构运算符,也不会特别麻烦。 <UserSearch {...obj} /> |
脚手架中的代码就按第二种吧。 |
好的,采用第二种 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我们推荐传入dispatch还是让组件暴露接口,外部来调用?
https://github.com/dvajs/dva/blob/master/examples/user-dashboard/src/routes/Users.jsx#L32
第2种组件聚合性更好,但是方法多了要开很多接口。
大家觉得我们日常写的时候推荐哪种。
@sorrycc @ChrisFan @zinkey @afc163 @yiminghe @LeuisKen
The text was updated successfully, but these errors were encountered: