Chapter 10 · Example 2 · Closures in React

Caching a closure

Storing a returned function in an external cache freezes its captured value, and comparing the previous value before refreshing the cache fixes it.

Loading live editor…