DEV Community

Discussion on: Refactoring Higher-Order Components (HOC) to React Hooks

Collapse
 
davidkutas profile image
davidkutas

what happens in a situation when you already bound your API call(s) into a useEffect method - in the same way as you write it, but later you need to call the previously set up API call inside yet another usEffect? It will throw an error, because useEffect can only be used in the top of the component; however I do not find the solution how to avoid issues like this.

looking forward to your insights.