DEV Community 👩‍💻👨‍💻

Discussion on: useAxios : A simple custom hook for calling APIs using axios

bushblade profile image
Will Adams

Interesting, though a few things I'm not clear on.

  1. Why not use an instance of axios instead of setting defaults?
  2. Axios stringifies and parses JSON for you, so why did you stringify and parse?
  3. Why do you have local state in App when it's the same data as the response you get from your hook? I don't see any reason for duplicating it or using state or useEffect in App.

Some comments have been hidden by the post's author - find out more