got add, remove, and edit actions working

This commit is contained in:
Ken
2019-02-01 09:47:04 -08:00
parent 260b6177fe
commit 0e0ea2ef06
9 changed files with 860 additions and 108 deletions

View File

@@ -2,15 +2,12 @@ import { createReducer } from './createReducer';
import { Store, FilterTypes } from '../store';
import { combineReducers } from 'redux';
let counter = 0;
export const reducer = combineReducers<Store>({
todos: createReducer<Store['todos']>(
{},
{
add(draft, action) {
const id = String(counter++);
draft[id] = { label: action.label, completed: false };
draft[action.id] = { label: action.label, completed: false };
return draft;
},