This commit is contained in:
2025-06-05 19:15:04 +02:00
commit e29ff6a755
17 changed files with 3425 additions and 0 deletions

17
lab07/src/reducer.js Normal file
View File

@ -0,0 +1,17 @@
const initialState = {
input: '',
list: []
};
export default function appReducer(state = initialState, action) {
switch (action.type) {
case 'input/update':
return { ...state, input: action.payload };
case 'input/clear':
return { ...state, input: '' };
case 'list/add':
return { ...state, list: [...state.list, action.payload] };
default:
return state;
}
}