Hey guys, I’m struggling at this point with
useEffect() in React Hooks. I had working code and now switching over to Hooks, I am unsure how to get my Post, Put, & Delete requests in
useEffect() within the same parent component (unless a better practice would be to modularize the requests?) and pass the data down into the child components. How can I have my async functions that handle the requests and updating the state in a
useEffect() while also passing the function down as a prop to be available on click? Also, does the dependency array need to have a piece of state to rely on at all times?
The GET request is currently in a
useEffect() and working properly. The POST & DEL both seem to work being outside of the
useEffect() , I just know it’s not good practice and I need to get this right. I have tried digging through the docs and googling, but I’m pretty stuck.