what is state and reducer 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 ;
}
}