DEV Community

Discussion on: React hooks in Axios interceptors

Collapse
 
clefayomide profile image
clefayomide • Edited

i think a better approach is to prevent the request from running on initial render. this helped me, stackoverflow

Collapse
 
radandevist profile image
Andrianarisoa Daniel

@iamyoki 's answer is workin for me!! And rather simpler to understand.
I indeed tried preventing the request from running on initial render as you suggested but the interceptor stayed unsed for the following renders too.