DEV Community

Discussion on: useAxios: React hook for any Axios call

Collapse
 
gaurav5430 profile image
Gaurav Gupta

does the infinite render loop happen because the config object is created new in every rerender of the parent, which leads to running useEffect again?

Collapse
 
kwhitejr profile image
Kevin White

Moving the axiosConfig declaration out of the App component did indeed stop the re-render loop! Great tip!