Re:React v16.3.0: New lifecycles and context API
by myth_drannon on Thursday March 29, 2018 @09:34PM
(#16712903)
For different reasons I don't use Redux that much in my app. The state is persisted in the url, or to be more precise React-Router's location. So let's say I have five different components on the page. All of them receive location and history as props. Each component updates the url separately, let's say a table updates the url with sort1=blah now the component needs to read this param compare next and current and fetch the new data in componentWillReceiveProps. All components verify if the url was updated with the url param they need and only the one that had it changed will fetch data. I use componentWillReceiveProps everywhere. I'm not sure if there is another life cycle to do just that.
[ Parent
| on HN ]
Re:React v16.3.0: New lifecycles and context API
by danabramov on Thursday March 29, 2018 @10:42PM
(#16713271)
I believe it's in the blog post:
https://reactjs.org/blog/2018/03/27/update-on-async-renderin...
(TLDR: Use `componentDidUpdate` for this.)
Have you had a chance to skim through it?
Re:React v16.3.0: New lifecycles and context API
by myth_drannon on Monday April 02, 2018 @09:59AM
(#16734500)
Yes, I also saw your post on twitter. I will try to use it from now on. Thanks!