5 State management and the application’s lifecycle

This chapter covers

  • Understanding state management
  • Implementing a state management solution
  • Mapping JavaScript events to commands that change the state
  • Updating the state using reducer functions
  • Re-rendering the view when the state changes

Some time ago, I went to the coast in the south of Spain, to a small village in Cadiz. One restaurant was so popular that it ran out of food quickly; it served a limited quantity of the dishes on the menu. As waiters took orders from customers, they updated a chalkboard with the number of servings the restaurant had left, and when no more of a particular dish was left, they crossed it out. The customers could easily tell what they could order by looking ...

Get Build a Frontend Web Framework (From Scratch) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.