DEV Community

Cover image for Week 15 React Learning Recap: Understanding Old React and Finally Respecting useReducer
Usama
Usama

Posted on

Week 15 React Learning Recap: Understanding Old React and Finally Respecting useReducer

This week was not about learning something flashy.

It was about understanding how things actually work under the hood.

I spent most of this week working with old React code patterns and class components. At the same time, I also started properly learning useReducer, which completely changed how I think about state management.

This week felt like a bridge between old React and modern React.


Understanding Old React Code (Class Components Are a Different World)

This week, I intentionally stepped into pre-hooks React.

I built a project called Classy Weather using only class components. The goal was simple:

Learn how real old codebases are structured and how they think.

Through this, I learned:

  • How state works in class components
  • How events are handled in class components
  • How child-to-parent communication works without hooks
  • How data fetching is done using lifecycle methods
  • How componentDidMount and componentDidUpdate replace useEffect
  • How side effects and localStorage syncing were handled before hooks existed

The most important realization:

Class components are not “bad”.
They just have a different mental model.

Understanding them made me much more confident that I can read and maintain old React projects in real companies.

Project:
Classy Weather


Class Components vs Function Components (The Mental Shift)

Before this week, I only used function components.

This week, I finally felt the difference.

In function components:

  • You think in effects
  • You think in hooks
  • You think in state snapshots

In class components:

  • You think in lifecycle phases
  • You think in when to run logic
  • You think in how state mutates over time

After writing both styles, I can now clearly say:

Hooks are simpler to write.
Class components are harder to reason about.
But understanding both makes you a much stronger React developer.


useReducer: The Second Big Learning of This Week

Alongside class components, I also started learning useReducer.

And now I understand why:

The course calls it an advanced / pro-level hook.

useReducer is not hard because of syntax.

It is hard because it forces you to think differently:

  • You don’t directly change state
  • You dispatch actions
  • A reducer function decides how state changes
  • All logic lives in one predictable place

This week I built a small date counter project using useReducer just to understand:

  • Actions
  • Dispatch
  • Reducer flow
  • Centralized state logic

I won’t pretend I’ve mastered it.

But now:

  • The fear is gone
  • The mental model is clear
  • And I finally understand why this hook exists

Final Thoughts

This week taught me something very important:

Not every week is about learning new APIs.
Some weeks are about becoming a more serious engineer.

This week helped me:

  • Read old React code
  • Understand class-based architecture
  • Respect lifecycle methods
  • And start thinking in reducers and actions

I feel like my React foundation is much stronger now.

Top comments (0)