Command Palette

Search for a command to run...

Hectal
Phase 14: Charts in React
Data Visualization · Exercise 3 of 5 PreviousNext
Intermediate

One axis, even in StrictMode

This component draws a D3 axis in an effect, and the page runs it in StrictMode, so the effect runs twice. Today two axes are drawn on top of each other.

Fix the effect so there is exactly one axis line and 5 ticks.

What Check tests

  1. Exactly one axis line
  2. Exactly 5 tick marks
  3. The effect cleans up
  4. No attribute holds NaN

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.