14 Matching Annotations
  1. Nov 2021
    1. In effect, the $ syntax we've seen above will actually setup a subscription to the store. And the subscription will be cancelled when the component is destroyed. If the store is subscribed by multiple components, the store will be disposed only when the last component unsubscribes (it will be reinitialized, if a new subscription is made). This is very handy to manage the lifecycle of disposable things in your code.
  2. Mar 2021
    1. Third configurable block to run.

      I like how they identify in the description which order things run in: 1st, 2nd, 3rd, and last.

      Though, it would be more readable to have a list of them, in chronological order, rather than having them listed in alphabetical order.

    2. Last configurable block to run. Called after frameworks initialize.
  3. Jan 2021
    1. Knowing exactly what happens in your application can mean the difference between feeling in full control or experiencing deep frustration. Personally, unknowns drive me crazy, which in turn often leads to all sorts of experiments and/or debug sessions.
    1. beforeUpdate(async () => { console.log('the component is about to update'); await tick(); console.log('the component just updated'); });
  4. Oct 2020
    1. The best place to initialize a FormValidation instance is inside the component's onMount event:

      Why? Presumably because it needs access to a form element (document.getElementById('loginForm'))...

  5. Sep 2020
    1. With useEffect, you can handle lifecycle events directly inside function components. Namely, three of them: componentDidMount, componentDidUpdate, and componentWillUnmount. All with one function!
  6. Aug 2020
    1. It's recommended to put the fetch in onMount rather than at the top level of the <script> because of server-side rendering (SSR). With the exception of onDestroy, lifecycle functions don't run during SSR, which means we can avoid fetching data that should be loaded lazily once the component has been mounted in the DOM.