box(key, reducer) takes a reducer and maps it to the given key.
Another convenience reducer, id(reducer, getId: (action) => id) could take a reducer and, using the given getId, map actions matched by that reducer into an id derived from the action.
This is very similar to "lens", but there's really only one use case where lens makes sense, so an actual lens implementation would be overkill.
box(key, reducer)
takes a reducer and maps it to the given key.Another convenience reducer,
id(reducer, getId: (action) => id)
could take a reducer and, using the givengetId
, map actions matched by that reducer into anid
derived from the action.This is very similar to "lens", but there's really only one use case where lens makes sense, so an actual lens implementation would be overkill.