Grid Lights II
Build a grid of light cells where you can click on cells to activate them, turning them green. When all the cells are activated, all the cells will be deactivated one by one in the reverse order they were activated with a 300ms interval in between them.
Requirements
-
Show the heading: Grid Lights
-
Render a 3x3 grid
<div data-testid="grid-lights"> -
Each cell:
- Has
data-testid="cell-{index}"(index from 0 to 8) - Uses class
celland optionallyactivewhen turned on - Activates (adds
activeclass) on click, unless already active or deactivating
- Has
-
Once all 9 cells are active:
- They should deactivate in reverse order (from last clicked to first) with a 300ms delay between each
-
Show a Reset Grid button
<button data-testid="reset-btn"> -
On click, it resets the grid to the initial state
Reference UI

Companies:
Solve Similar questions 🔥
Want to upskill? Explore our courses!
Namaste DSA
Master DSA from scratch with numerous problems, and expert guidance.
Namaste React
Wanna dive deep into React and become Frontend Expert? Learn with me now!
Namaste Frontend System Design
The most comprehensive and detailed course for frontend system design.
Namaste Node.js
Wanna dive deep into Node.js? Enroll into `Namaste Node.js` now!
