Use Volatile State and Lifecycle Methods to Manage Private State

MST has a pretty unique feature: It allows you to capture private state on models, and manage this state by using lifecycle hooks. For example by setting up a WebSocket connection and disposing of the connection automatically as soon as the instance gets removed from the store. In this lesson, we will leverage cancellable fetches to abort in-flight requests when appropriate

In this lesson you will learn:

  • Aborting window.fetch requests :-).
  • Storing private, volatile, internal state in the function closure
  • A second life-cycle hook: beforeDestroy
Please take a moment to tell your friends:

You must be a PRO Member to view code