-
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
在model里面,我怎么定义非状态的变量? #130
Comments
|
@sorrycc ,我reducer这样,有问题没:
2、我想吧dva,reactjs,一些第三方库和业务拆分出来,因为变化的只会是业务。 |
有问题,这样 reducer 就不是 pure function 了,出问题时会不好排查。 |
但是我怎么写会比较好一点,我确实不希望有些变量放到state里面,没有意义。 |
可以在 effect 里获取 _items 和 _loadedAll,通过 payload 传给 reducer 。 |
好的,明白,就是把这个变量赋值逻辑放在effect里面,reducer纯粹改变state就行。谢谢。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1、rn的ListView,ds.cloneWithRows(items),那么我必须保存一份items数据,ds是状态变量,items是不需要放到状态里面的,因此,我只是希望在model中做一个非状态的变量,我现在是这样做:
`
不知道是否合理?
2、dva for web,怎么拆分index.js,现在快1M了?
3、比如有个变量,rn的ListView的refreshing,类似loading,我将fetch的error都放到dva的onError里面了,因此,如果有错,都由onError处理了,那么我怎么在error时关闭refreshing?
The text was updated successfully, but these errors were encountered: