← All videos

Engineering video

8:06 · 7 August 2024

How NOT to Fail A React Interview: 7 Junior Mistakes To Avoid

Chapters 4 sections

  1. 0:00Introduction and State Mutation
  2. 1:13Nested Components and Effect Abuse
  3. 3:47Hook Placement and List Keys
  4. 5:34Ambiguous Components and Consolidated Context

Key concepts in this video:

1. Modifying State Directly

Mutating state directly instead of computing a new version of the state breaks immutability and prevents React from properly updating the fiber, virtual DOM, and DOM.

Hear it at 0:31 →

2. Declaring Components Inside Another Component

Declaring a component inside another causes it to be recreated on every parent render, forcing React to treat it as a new element and needlessly re-render the entire list.

Hear it at 1:13 →

3. Abusing the Use Effect Hook to Chain State Updates

Using useEffect to trigger dependent state changes causes extra rendering passes because effects run after the render and commit phases. Instead, update state directly in event handlers so React can batch the updates.

Hear it at 2:04 →

4. Not Using Hooks at the Top of a Component

Failing to place all hooks at the very top of a component violates the rules of hooks and makes component structure harder to follow.

Hear it at 3:47 →

5. Using Array Indexes as List Item Keys

Using unstable keys like array indexes prevents React from optimizing reconciliation when items shift or are removed, forcing a re-render of the full list.

Hear it at 4:17 →

6. Over-Engineering Ambiguous Components

Creating single over-engineered components that render different elements based on a type prop creates bloated interfaces and difficult test cases, violating solid principles.

Hear it at 5:34 →

7. Consolidated Context Providers

Grouping independent data that changes separately into a single massive context provider forces unrelated components to re-render whenever any piece of the context state changes.

Hear it at 6:29 →

Transcript

I've done dozens of react JS interviews at Junior mid and senior level in the process I went from getting stuck with simple react problems to getting six figure offers from several companies all this while the job market it's completely crazy today I will share with you the seven most common reaous interview mistakes developers make that stops them from passing the interview and getting an offer if you don't know who I am I'm Bon principal engineer and co-founder at the senior Dev where in the last 4 years we helped over 250 JavaScript Developers level up to senior and Beyond now the number one mistake