Skip to content
This repository has been archived by the owner on Aug 1, 2018. It is now read-only.

Add opts.componentDidUpdate #86

Merged

Commits on Apr 8, 2018

  1. [feature] add opts.componentDidUpdate

    `componentWillReceiveProps` is soon going to be deprecated in future versions of react.
    
    The new recommendation for making side-effects when there is a difference between current + previous props is to do so in `componentDidUpdate` (see: https://reactjs.org/docs/react-component.html#componentdidupdate)
    
    When react enables async rendering in future releases of react, this will break lifecycle methods into "render" phase and "commit" phase. Methods in the "render" phase (includes `componentWillReceiveProps`) are meant to be side-effect free as they might be called multiple times.
    
    `componentDidMount` and `componentDidUpdate` are called in the "commit" phase and are the recommended place for side-effects (includes network calls). see: https://reactjs.org/docs/strict-mode.html#detecting-unexpected-side-effects
    
    twitter thread with more context: https://twitter.com/ken_wheeler/status/983022255746768897?s=20
    
    The current change is BC since we are only adding a new feature.
    koulmomo committed Apr 8, 2018
    Configuration menu
    Copy the full SHA
    d508e5b View commit details
    Browse the repository at this point in the history