4 Matching Annotations
- Oct 2020
-
reactjs.org reactjs.org
-
Otherwise, your code will reference stale values from previous renders.
Tags
Annotators
URL
-
- Sep 2020
-
docs.google.com docs.google.com
-
This is the stale closure problem. Because this function closes over the original value of count, which is zero, we only ever set the count to 1. It turns out that in order to use setInterval we have to jump through some hoops.
-
-
reactjs.org reactjs.org
-
The mydata object might contain references to functions which have captured variables within closures. There is no way for React to peek into these closures, and thus no way for React to copy them and/or verify equality.
-
- Sep 2019
-
leewarrick.com leewarrick.com
-
This is a ”stale closure”. I won’t get into closures, but just know that because of the implementation of React/hooks, the count variable is always going to be 0 in our interval function. It’s an old reference.
-