Search⌘ K
AI Features

Making the Reducer Count

Explore how Redux reducers process different actions to update application state. Learn to use switch statements within reducers to handle actions like SET_TECHNOLOGY and return new state accordingly. Understand how these concepts make state management predictable and effective in React apps.

We'll cover the following...

Up until now, the reducer we’ve worked with hasn’t done anything particularly smart. It’s like a Cashier who is new to the job and does nothing with our WITHDRAW_MONEY intent.

What exactly do we expect the reducer to do?

For now, here’s the initialState we passed into createStore when the STORE was created.

Javascript (babel-node)
const initialState = { tech: "React" };
export const store = createStore(reducer, initialState);

When a user clicks any of the buttons, thus passing an action to the reducer, the new ...