---
title: "Comment by An Vo on \"Why React renders?\" | Hashnode"
description: "Nice about the tricky thing that inside the handleClick function, the alert(theme) is &quot;light&quot; even though we&#39;ve just setTheme(&quot;dark&quot;)"
url: "https://hashnode.com/posts/why-react-renders/64d7883feacd4627cb2212be/comment/64d7aefa102c3648a77c758e"
---

[Discussion](https://hashnode.com/posts/why-react-renders/64d7883feacd4627cb2212be)

Comment [Why React renders?](https://hashnode.com/posts/why-react-renders/64d7883feacd4627cb2212be)

[An Vo](https://hashnode.com/@anvodev)

[Aug 12, 2023](https://hashnode.com/posts/why-react-renders/64d7883feacd4627cb2212be/comment/64d7aefa102c3648a77c758e)

Nice about the tricky thing that inside the `handleClick` function, the alert(theme) is "light" even though we've just `setTheme("dark")`

[Sakshi Chaudhary](https://hashnode.com/@sakshiChaudhary)

[Aug 13, 2023](https://hashnode.com/posts/why-react-renders/64d7883feacd4627cb2212be/comment/64d7aefa102c3648a77c758e#reply-64d86f5dd459393b57af9fd2)

Thank you! glad you find it useful
