Core concepts, definitions, basic syntax, and first principles expected in round 1 screening.
(previousState, action) and return the next state, with no side effects.
These three rules give you time-travel debugging, deterministic tests and trivial undo/redo foundations.getState(), dispatch(), subscribe().{ type, payload? } describing an event.state => state.cart.items).{ type: 'cart/add', payload: { id } }.const addToCart = id => ({ type: 'cart/add', payload: { id } }).createSlice generates creators automatically from reducer names.function cartReducer(state = initialState, action) {
switch (action.type) {
case 'cart/add':
return { ...state, items: [...state.items, action.payload] };
default:
return state;
}
}
Rules:
You've completed the 5 free sample questions. Get unrestricted lifetime access to every question, model answer, implementation challenge, and all 27+ technologies for a single payment.
₹399 India / $9 International · One-time settlement · Zero subscription