One of the more common things you will do when writing React components is some sort of http request to get data or to update some data. This will usually involve some combination of the useEffect and useState hooks provided to us by the core React library. Now, to be fair there are many ways to use useEffect, useState and other hooks to do all sorts of things. The refactoring tips to follow are applicable not only to data retrieval but to any scenario where there are relationships between data and there is some level of complexity.
This repo contains examples that follow along with this blog post:
https://www.codingzeal.com/post/cleaner-react-refactoring-hooks
Reach out to me on Twitter @sturdynut 👋