ReactComponentKit / Redux

Manage iOS App state with Redux and Async/Await :)
MIT License
24 stars 0 forks source link

Add commit(mutation:) method #9

Closed skyfe79 closed 2 years ago

skyfe79 commented 2 years ago

Summary

Add commit(mutation:) which has no payload parameter. We can reduce the codes to define store's action like below:

Button(action: { store.counter.incrementAction(payload: 1) }) {
    Text(" + ")
        .font(.title)
        .bold()
}

to be

Button(action: { store.counter.commit { $0.count += 1 }) {
    Text(" + ")
        .font(.title)
        .bold()
}

Changed