重击思想
支持的Swift版本: Swift 4.2,Swift 5.0,Swift 5.3
当是Swift中单向数据流体系结构的类似的实现时,ReSwift-Thunk就像。
为什么要使用ReSwift-Thunk?
例
// First, you create the middleware, which needs to know the type of your `State`.
let thunkMiddleware : Middleware = createThunkMiddle
redux-saga-thunk
调度由处理的操作将返回promise。 它看起来像 ,但具有纯粹的动作创建者。
class MyComponent extends React . Component {
componentWillMount ( ) {
// `doSomething` dispatches an action which is handled by some saga
this . props . doSomething ( ) . then ( (