Fakultas Ilmu Komputer UI

reducer.tsx 391 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { AnyAction } from "redux";
import { ICategory } from "../../types/firestore";

const initialState: ICategory[] = [];

const ecosystemReducer = (
  state = initialState,
  action: AnyAction
): ICategory[] => {
  switch (action.type) {
    case "CATEGORIES": {
      return action.payload as ICategory[];
    }
    default:
      return state;
  }
};

export default ecosystemReducer;