4 Matching Annotations
  1. Oct 2020
  2. Sep 2020
    1. 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.

    1. 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.
  3. Sep 2019
    1. 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.