Build a small React application using TypeScript. This exercise tests:
- API fetching
- Component architecture
- Custom hooks
- Typescript interfaces & typing logic
- Error & loading handling
-
Fetch users from: https://jsonplaceholder.typicode.com/users
-
Display the list of users with:
- name
- company name
-
Create a custom hook:
useUsers()that:- fetches users
- returns { users, loading, error }
-
Add a search input that filters the user list by name.
-
Add TypeScript types everywhere:
- User type
- Hook return type
- Component props type
- Display user details in a separate component
- Add sorting controls
- Add debounce to the search input
- src/hooks/useUsers.ts
- src/App.tsx
The solution branch contains a complete working example.