A small Expo / React Native app used as a live coding exercise for React Native developer interviews.
The app is meant to fetch a list of users from the Random User API and display them in a scrollable list, showing a spinner while loading and an error message if the request fails.
The candidate should complete the following parts in order:
The app compiles, but it does not work as intended. Find what is missing and fix it so that the list of users loads and renders correctly.
Make sure API errors are surfaced to the user via the ErrorMessage component.
To verify the error handling works, temporarily break the API URL:
https://randomuser.me/aaaaaa/?page=1&results=10&seed=abc
The error should show up in the UI. Then switch it back to continue the exercise:
https://randomuser.me/api/?page=1&results=10&seed=abc
Refactor the list rendering to use a FlatList instead of a ScrollView.
Discussion point: the candidate should be able to explain the difference between the two (eager rendering of all children vs. lazy/virtualized rendering, memory usage, when to use each).
Load more users as the user scrolls to the end of the list, using the page query parameter of the API.
npm install
npx expo startThen open the app in the Expo Go app on your phone, or in an iOS/Android emulator.
App.tsx— main app component (the exercise happens here)components/Spinner.tsx— loading indicatorcomponents/ErrorMessage.tsx— error display
Licensed under the Apache License 2.0.