Promptles
React & Frontend

Memoization

advanced

Definition

Remembering the answer to an expensive question so you don't have to figure it out from scratch every time. As long as the inputs haven't changed, you hand back the saved answer instead of redoing the work.

In the wild

A spreadsheet app calculates the total of 10,000 rows. That total is memoized: saved aside. The next time the page redraws, the app checks: 'have any of those 10,000 rows changed?' If not, it skips the math entirely and reuses the saved total in an instant.

More from React & Frontend