Open BigAB opened 5 years ago
Maybe a better approach would be to allow the Epic
function define the action creators?
const restaurantFilterEpic(actions$, state$) {/*...*/}
restaurantFilterEpic.actions = {
handleRegionChange: ['SELECT_REGION', (e) => e.target.value],
handleCityChange: ['SELECT_CITY', (e) => e.target.value],
handleRestaurantChange: ['SELECT_REGION', ([e) => e.target.value],
}
In retrospect, in my last comment, the e => e.target.value
does not belong there
Is your feature request related to a problem? Please describe.
Having to define a lot of callbacks from the dispatch method can be tedious:
Describe the solution you'd like I'd like an option, to receive action creator style methods instead of the dispatch, perhaps something like:
The
actions
option should memoize the callbacks, but in a more efficient way thanuseCallback
Describe alternatives you've considered
After writing the examples I have to question: Is it worth it, the amount of code written is pretty close, maybe this isn't the best idea?