Unit Test for Custom React Hook
I am practicing unit testing, I am using a react-testing-library with vitest. I have a custom hook that fetches the user data of the given user id. How can I test it with unit tests I am able to write unit test which actually fetches the data from the API. but is it a good approach? I read each unit test should be done in milliseconds. if we fetch data from server it will take longer. How can I avoid this situation and efficiently test it.
