Skip to content

PRO TIP Block youtube.com at the DNS level โ€” Pi-hole, NextDNS or your hosts file โ€” but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

ReactJS Tutorial 66: Using Object As State In useReducer

6.2K views on YouTube

๐Ÿ”ง Building a React app and need a backend?
Learn FastAPI โ€” the modern Python backend that pairs perfectly with React.
โœ… JWT Authentication, OAuth, REST APIs โ€” everything your React app needs.
๐Ÿ‘‰ FastAPI Complete Course (limited discount): https://www.udemy.com/course/fastapi-course-python/?couponCode=YOUTUBE2026

๐Ÿ“ฆ Also check out:
โ€ข Django Masterclass (44hrs, 9 real projects): https://www.udemy.com/course/django-course/?couponCode=YOUTUBE2026
โ€ข Python Masterclass 2026 (80hrs):https://www.udemy.com/course/python-masterclass-course/?couponCode=YOUITUBE2026

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ In this lecture we will learn how to use an object as state in a useReducer.
To use an object as the state in useReducer, you simply define your state as an object and structure your reducer function to update different parts of that object based on the actions.

Steps to Use an Object as State in useReducer:
Define the initial state as an object: This will represent the state structure.
Set up the reducer function: The reducer function will handle state transitions and update specific properties of the state object based on the action.
Use the useReducer hook: Pass the reducer and the initial state object to the useReducer hook.