Slide 9
Slide 9 text
export function reducer(state = initialState, action: NotesActions): State {
switch (action.type) {
case NotesActionTypes.CreateNoteSuccess: {
return {
...state,
notes: [...state.notes, action.payload],
loaded: true,
loading: false
}
}
case NotesActionTypes.LoadNotesSuccess: {
return {
...state,
notes: ...action.payload,
loaded: true,
loading: false
}
/* ... */
Redundant Code