0
Q:

redux reducer

const Reducer = (state=[],action) =>{
	switch(action.type){
      case'add':
        return [...state,action.payload]
      default:
        return state ;
    }
}
1
const reduxSinaxe = (state = [], action) => {
  switch (action.type) {
    case "@smthg/ACTION":
      const { anyConst } = action;
      return [...state, anyConst];

    default:
      return state;
  }
};

export default reduxSinaxe;
0
import { combineReducers } from 'redux';

const INITIAL_STATE = {
  current: [],
  possible: [
    'Alice',
    'Bob',
    'Sammy',
  ],
};

const friendsReducer = (state = INITIAL_STATE, action) => {
  switch (action.type) {
    default:
      return state
  }
};

export default combineReducers({
  friends: friendsReducer
});
0

New to Communities?

Join the community