DEV Community

Discussion on: 🍦 Cancel Properly HTTP Requests in React Hooks and avoid Memory Leaks 🚨

Collapse
 
sqlrob profile image
Robert Myers • Edited

Right, I understand why it works, but why pick one over the other? Would it be faster to not wrap in useCalllback and use []? This is a fetch, so I guess any savings would be washed away in network.

Thread Thread
 
viclafouch profile image
Victor de la Fouchardière

I want to have a function for getting my data. Maybe in the future I would like to have a button to "refresh" my data. And call "fetchPosts" by clicking on it. Or maybe, for my future pagination by adding page as a new parameter of my function fetchPosts.