Course contentsShow
← React
Lesson 327 of 2,3969. Class Components (Legacy Overview)Free lesson

When Teams Haven't Migrated Yet

Working with teams still using classes: consistency considerations and gradual migration strategies.

When Teams Haven't Migrated Yet

What you'll learn: How to navigate working in teams that still use class components, balancing consistency with gradual improvement.

The Reality Check

You've learned Hooks are modern React, but many production codebases haven't migrated yet. Maybe the team has legacy code, tight deadlines, or simply hasn't prioritized the refactor. This isn't a failure—it's reality. Your challenge is working effectively now while positioning the codebase for eventual improvement.

Consistency Over Perfection

When joining a class-heavy codebase, match the existing style first. If every component uses componentDidMount and this.setState, don't suddenly introduce useEffect in one file. Inconsistency creates confusion: developers won't know which pattern to follow for new features.

Think of it like joining a kitchen that uses imperial measurements—switching to metric mid-recipe causes chaos, even if metric is "better."

Gradual Migration Strategies

Write new features as functions when appropriate, but only if your team agrees on this direction. Create a migration plan:

  1. Isolate boundaries – New feature areas can use Hooks while old areas stay class-based
  2. Leaf components first – Migrate simple presentational components before complex stateful ones
  3. Test coverage – Don't migrate without tests confirming behavior stays identical
  4. Document the approach – Team wiki or README explaining "when to use what"

Communication is Key

Talk to your team. Ask: "Are we planning to migrate?" If yes, propose lightweight guidelines. If no, respect that decision and become excellent at reading/writing class components.

Key Takeaway: In codebases that haven't migrated, prioritize consistency and team alignment over using the "latest" patterns—a cohesive codebase beats a mixed one, and migration requires collective buy-in, not individual heroics.