Write a useFetch hook with loading, error and abort on unmount or URL change.
MediumP2Coding
Write a useFetch(url) hook that loads JSON and reports the state of the request.
const { data, error, status } = useFetch(url);
Build a demo with a text input or buttons that change the URL, showing the three states. Use any public JSON API, or a function that fakes fetch with a delay.
Time box: 40 to 50 minutes.
Requirements
0 / 7Stretch goals
0 / 3Only after every requirement works.
Hints
Workspace
Your files are saved in this browser as you type.
When every requirement works, mark it complete to count it as solved.
Solution notes
How a strong candidate structures it, and what interviewers check.
Saved automatically