Hi Antonin, Thanks for writing this. I think it's very useful.
I have one comment regarding your useUser hook. I think it's important to "cancel" the request before the component unmounts to avoid memory leaks.
I wrote about it a few days ago. You might want to have a look: dev.to/juliang/cancelling-a-promis...
In this case there's no memory leak though.
It's simply a warning as updating the state will effectively do nothing after the component has been unmounted.
Hi Antonin, Thanks for writing this. I think it's very useful.
I have one comment regarding your useUser hook. I think it's important to "cancel" the request before the component unmounts to avoid memory leaks.
I wrote about it a few days ago. You might want to have a look:
dev.to/juliang/cancelling-a-promis...
Cheers!
In this case there's no memory leak though.
It's simply a warning as updating the state will effectively do nothing after the component has been unmounted.
Ah. I see your point. I suppose the dangling reference to the component gets garbage-collected after the promise resolves and state is updated?