tkh44 / holen

Declarative fetch for React
MIT License
150 stars 16 forks source link

Prepare for async rendering #26

Open ThePaulMcBride opened 6 years ago

ThePaulMcBride commented 6 years ago

To prepare for async rendering coming in a not too distant version of React, the following lines of the use of the lifecycle method componetWillReceiveProps should be removed.

Here is where it is currently being used. https://github.com/tkh44/holen/blob/master/src/index.js#L25-L31

According to this great article by the React team the best option is to use the new lifecycle method getDerivedStateFromProps.

The React team have released a polyfill for this method which would maintain backwards compatibility.

Let me know if you'd like help implementing this.

tkh44 commented 6 years ago

If you would like to do this I would be grateful. I have started to use https://github.com/jamesplease/react-request more than this library. I should probably put up a link on the readme.