September 2018
Intermediate to advanced
302 pages
7h 17m
English
Thunk is another pattern that isn't specific to React or Redux. Actually, it is used quite widely in many hardcore solutions, such as compilers.
Thunk is a pattern that delays evaluation until it cannot be avoided. One of the beginner examples that explains this is simple addition. An example is shown here:
// immediate calculation, x equals 3 let x = 1 + 2; // delayed calculation until function call, x is a thunk let x = () => 1 + 2;
Some more complex usages, for instance, in functional languages, may rely on this pattern throughout the entire language. Hence, computations are performed only when the end application layer needs them. Usually, no ahead-of-time computations are performed, as such optimizations ...
Read now
Unlock full access