1const Reducer = (state=[],action) =>{
2 switch(action.type){
3 case'add':
4 return [...state,action.payload]
5 default:
6 return state ;
7 }
8}
9
1const reduxSinaxe = (state = [], action) => {
2 switch (action.type) {
3 case "@smthg/ACTION":
4 const { anyConst } = action;
5 return [...state, anyConst];
6
7 default:
8 return state;
9 }
10};
11
12export default reduxSinaxe;
1import { combineReducers } from 'redux';
2
3const INITIAL_STATE = {
4 current: [],
5 possible: [
6 'Alice',
7 'Bob',
8 'Sammy',
9 ],
10};
11
12const friendsReducer = (state = INITIAL_STATE, action) => {
13 switch (action.type) {
14 default:
15 return state
16 }
17};
18
19export default combineReducers({
20 friends: friendsReducer
21});