Package Exports
- ngrx-etc
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ngrx-etc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
NgRx-etc
mutableOn
The mutableOn function offers direct state mutations in reducers.
const entityReducer = createReducer<{ entities: Record<number, { id: number; name: string }> }>(
{
entities: {},
},
mutableOn(create, (state, { type, ...entity }) => {
state.entities[entity.id] = entity
}),
mutableOn(update, (state, { id, newName }) => {
const entity = state.entities[id]
if (entity) {
entity.name = newName
}
}),
mutableOn(deleete, (state, { id }) => {
delete state.entities[id]
}),
)