在redux动作创建者内部,是否合理地简单地要求redux商店使用require('path/to/store')
来访问getState()
和dispatch()
因为它是单例的?
No, please don't do that - importing the store directly is an anti-pattern .
Use the redux-thunk
middleware instead, as it's specifically intended for this use case.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.