Todo List๋ฅผ ์ฒ์ ์์ํ๋ฉด์ ๋ง๋ ์ฅ์ ๋ฌผ
import { combineReducers } from 'react-redux';
import * as ActionTypes from '../actions/ActionTypes';
const todos = (state = {}, action) => {
switch ( action.type ) {
case ActionTypes.ADD_TODO:
return {
// ...state,
// {
// [],
// },
// ...state,
[
...state.todos,
{
id,
text
}
]
[{},{},{}]
};
case ActionTypes.REMOVE_TODO:
return filter(t => {});
default:
return state;
}
}
const todoApp = combineReducers({
todos
});
export default todoApp;
import { combineReducers } from 'react-redux';
import * as ActionTypes from '../actions/ActionTypes';
const todos = (state = {}, action) => {
switch ( action.type ) {
case ActionTypes.ADD_TODO:
return {
// ...state,
// {
// [],
// },
// ...state,
...state,
[
{
id: state.id++,
text: action.text
}
]
[{},{}], [{}]
};
case ActionTypes.REMOVE_TODO:
return filter(t => {});
default:
return state;
}
}
const todoApp = combineReducers({
todos
});
export default todoApp;