Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

useEffect is precisely for getting/posting data. That is one of its purposes. If the react team is acting suddenly like it isn't they are ignoring... reality?


> useEffect is precisely for getting/posting data. That is one of its purposes.

Where is this said? Because everything I've read has been that doing any non-idempotent action in an effect will cause bugs. Therefore, GETting data is fine but POSTing it is not. I've read this even before these new beta docs.


Specifically a component can mount and unmount at strange times. If you expect use effect to only run once you may run into problems.


You are right. I messaged too quickly. When I think about the times I've used useEffect it has been to GET data for populating a page (as I recall). It has been a little while since I have done frontend hook dev.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: