what are reducers in redux code example
Example: redux reducer
const Reducer = (state=[],action) =>{
switch(action.type){
case'add':
return [...state,action.payload]
default:
return state ;
}
}
const Reducer = (state=[],action) =>{
switch(action.type){
case'add':
return [...state,action.payload]
default:
return state ;
}
}