w3cj / use-x

Practice implementing custom react hooks with full test suites and examples.
https://www.youtube.com/watch?v=GDXsuoisg60
MIT License
12 stars 4 forks source link

Is the error reset during an AbortError redundant? #4

Open BenMcH opened 3 weeks ago

BenMcH commented 3 weeks ago

https://github.com/w3cj/use-x/blob/ca70f15c8921a0c5ac65dbc317dfb0af1fe22b91/src/use-fetch/use-fetch.solution.ts#L110-L113

Thanks for putting this test suite together! After completing the useFetch hook, I went back and compared my solution to the committed solution and noticed that this was the one functionality deviation between what I wrote and the expected solution. I would expect that this setError(null) is not actually needed, as the error is set to null at the top of the hook on line 91.

I may be missing an edge case, but the test suite didn't appear to be affected by the absence of that line.