why is componentdidupate better than getderivedstatefromprops
0
Performances reason: it avoids unnecessary re-render. As getDerivedStateFromProps is called before rendering on init, you can initialise your state in this function instead of having a constructor to do so. Currently you had to have a constructor or componentWillMount to init your state before initial rendering.
08/06/18