- 1

I have a doubt in the question given below from the react +redux course

Multiple Reducers Fill in the blanks to create a valid reducer function: _______reducer(state, action) { _________(action.type) { _______'ADD_ITEM': return [ ...state, action.item ] _____: _______ state } }

1st Jun 2021, 4:21 AM
Rudra Balan
Rudra Balan - avatar
3 Respuestas
+ 4
It's reducer function with switch statement. Correct Answer: function reducer(state, action) { switch(action.type) { case 'ADD_ITEM': return [...state, action.item] default: return state } }
5th Jun 2021, 12:03 PM
Jigar Sable
Jigar Sable - avatar
+ 4
Ultimate answer: function toggle(status) { return { type : 'TOGGLE', data: status } } function reducer(state, action) { switch(action. type ) { case 'TOGGLE': return { status: state.status+action.data }; default: return state; } }
12th Sep 2021, 2:45 AM
kutina thaddaeus
kutina thaddaeus - avatar
0
function switch case default return
22nd Sep 2022, 9:03 AM
LIPSA BEHERA