id | title | hide_title | sidebar_label |
---|---|---|---|
motivation |
Motivation |
true |
Motivation |
Redux and Redux DevTools both work great for following what is happening in your app.1
However, there are three pain points that at least one developer has encountered:
- Ugly boilerplate maintenance: one more slice of state = another load of action types, creators and reducers to write.
- Unhelpfully named constants: what was
NONTRIVIAL_THING_HAPPENED
meant to do, again...? - Repetitive reducer logic: an action that updates some slice of state to
true
? How novel!
1 cf. what you intended to happen in your app...
redux-leaves
is a library that is written to provide:
- Pleasingly little boilerplate: set up your reducer and actions in one line
const [reducer, actions] = reduxLeaves(initialState)
- Precise updates: easily increment that counter, no matter how deeply you nested it
dispatch(actions.distressingly.and.foolishly.deeply.nested.counter.create.increment(2))
- Predictable changes: understand exactly what's happening with clear and consistently named action types:
// action type dispatched above:
'distressingly/and/foolishly/deeply/nested/counter/asNumber.INCREMENT'