import {ADD, REMOVE} from "@/store/constant/todo" import {combineReducers} from "redux"; let initData: ITodo[] = [] const todos = (state = initData, action: IAction) => { switch (action.type) { case ADD: return [ ...state, { id: action.id, text: action.text } ] case REMOVE: const list = state.filter(v => v.id != action.id) return [ ...list ] default: return state } } export default todos;