Does this library support "Derived State"?
Say I dispatch a User action, so my AppState now has User profile information
I would like state.isLoggedIn to automatically be there also without me manually having to set this .isLoggedIn property
@ngrx has this concept called selectors to do just this.
I am wondering if ReSwift has this?
There is a library cal ReRxSwift which aims to connect state to props automatically like the connect function from react-redux
I don't know the ngrx stuff, so I cannot compare. What I'd do is expose a computed property, like I'd do without ReSwift, too:
struct AppState: StateType {
var userState: UserState
var isLoggedIn: Bool { return userState.isLoggedIn }
}
struct UserState {
var credentials: (String, UserID, UnsafePlainTextPassword)?
var isLoggedIn: Bool { return credentials != nil }
}
Am closing this because there was no activity for a while
Most helpful comment
I don't know the ngrx stuff, so I cannot compare. What I'd do is expose a computed property, like I'd do without ReSwift, too: