[Proposal] React for Void?
domasn opened this issue ยท 0 comments
domasn commented
Hi there ๐
My company struggled a bit after 2.0 removed react for non-equatable types. I think, it's absolutely reasonable to to require types returned by request be equatable.
Though, we are using Void?
in quite a few places to trigger feedback loops that don't require any parameters. Examples include anything from networking to navigation, from current location fetch to database sync.
We ended up writting a custom react
just for this case:
func react<State, Event>(request: @escaping (State) -> Void?,
effects: @escaping () -> Signal<Event>) -> (Driver<State>) -> Signal<Event> {
return react(request: { request($0) != nil ? true : nil }, // Bool to the rescue ๐
effects: { _ in effects() })
}
Do you think it would make sense to add a react for Void?
to RxFeedback? Have you encountered this?
Thanks!