Discussion Thread

Hania Rani
Hania Rani
Resolved

In lesson 6, the dependency array skips the `setCount` setter. Isn't it a stale closure risk?

4 replies
About this piece

Discussion Thread

Student Q&A card with an avatar header, resolved pill, clipped question body, and a reply count.

Usage

The import and the props worth knowing about, in one place.

import { Education16 } from "@/components/beste/piece/education16";

<Education16
  author="Hania Rani"
  initials="HR"
  imageSrc="https://images.unsplash.com/photo-1685703206477-aa1df00a1f0e?w=200&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8OTJ8fHBvcnRyYWl0fGVufDB8fDB8fHww"
  alt="Hania Rani"
  question="In lesson 6, the dependency array skips the `setCount` setter. Isn't it a stale closure risk?"
  replies={4}
  resolved={true}
  bordered={false}
/>

More Education pieces

View all Education
Ask me anything · Career pivotsMentor hours

Share your story and the thing you wish you knew earlier. I'll reply over the weekend.

38 answered
Question 3 of 10Which hook schedules an effect after the DOM is painted?
Nils Frahm
Nils FrahmReact instructor
24,182 students4.9 average
24 lessons
Design systems for shipping teams
Hania Rani
Lesson 6
useEffect runs after the DOM commit, not during render.Cleanup runs before the next effect, and on unmount.
Ask Priya about the stale-closure example in office hours.
Top of the cohort
1
Joep Beving
Joep Beving98
2
Poppy Ackroyd
Poppy Ackroyd94
3
Max Richter
Max Richter91