Slide 14
Slide 14 text
reducerΛఆٛ
# src/reducers/errors.tsx
export const errors = (state = initialErrors, action: AppAction): Errors => {
switch (action.type) {
+ case AppActionTypes.VALIDATION_FAILURE: // ࣦഊ࣌
+ return {
+ ...state,
+ ...action.errors
+ };
+ case AppActionTypes.VALIDATION_SUCCESS: // ޭ࣌
+ const nextState = { ...state };
+ delete nextState[action.key];
+ return nextState;
default:
return state;
}