Vigyata.AI
Is this your channel?

React 19 Tutorial - 28 - useReducer (simple state and action)

4.9K views· 139 likes· 8:12· Dec 8, 2025

🛍️ Products Mentioned (2)

Github - https://github.com/gopinav/React-19-Tutorials Become a Fullstack Developer with Scrimba - https://scrimba.com/fullstack-path-c0fullstack?via=Codevolution Follow me + Twitter - https://twitter.com/CodevolutionWeb Business - codevolution.business@gmail.com useReducer (simple state and action) in React 19

About This Video

Now that we understand the idea behind useReducer, in this video I put it into practice with a simple counter example. The goal is to get comfortable with the new pieces involved—actions, dispatch, and the reducer function—without adding any extra complexity. I rebuild the classic counter component, but instead of useState, I wire it up using useReducer so you can clearly see how everything fits together. I start by creating a reducer-based counter component with three actions: increment, decrement, and reset. The state is just a number, so the initial state is 0, and the reducer uses a switch statement to return the next state based on the action string. Then I show how useReducer returns a pair: the current state value (count) and a dispatch function that sends actions to the reducer. Once the buttons dispatch the right actions, React calls the reducer, updates state, and rerenders with the new count. The big takeaway is simple: actions describe what happened, dispatch sends those actions, the reducer decides the state transition, and your component rerenders with the updated state.

Frequently Asked Questions

🎬 More from Codevolution