SkinFirts loads the full doctor roster from MockAPI when the app starts and stores it in Redux so every screen can access the same live data without additional network calls. From the Doctors screen, users can sort and filter the list in five ways, tap through to a detailed profile, and mark any doctor as a favourite — changes to favourites are persisted back to the server immediately via a PATCH request.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/BhushanBadhe39/SkinFirts/llms.txt
Use this file to discover all available pages before exploring further.
Loading doctors
Doctors are fetched once on startup insideSplashScreen, which dispatches the loadDoctors async thunk:
fetchDoctors() sends a GET request to /doctorData and returns the array of doctor objects. On success, the thunk’s fulfilled handler stores the array in state.doctors.data. While the request is in flight, state.doctors.loading is true; on failure, state.doctors.error holds the error message.
Sort and filter options
TheDoctorsScreen exposes five sort/filter tabs controlled by a pageIndex integer. The active tab is reflected in both the header title and the rendered list.
| Index | Tab label | Behaviour |
|---|---|---|
0 | Doctors (A–Z) | Sorts all doctors alphabetically by doctorName |
1 | Rating | Sorts all doctors by ratings descending |
2 | Favorite | Filters to doctors where isFavorite === true, with sub-tabs for Doctors and Services |
3 | Female | Filters to doctors where gender === "Female" |
4 | Male | Filters to doctors where gender === "Male" |
pageList array that drives the header title is defined as:
useMemo that re-runs whenever the doctor data or the active pageIndex changes:
Favorite sub-tabs
WhenpageIndex is 2, an additional pair of buttons — Doctors and Services — appears. The primaryState boolean switches between the FavoriteDoctors component (renders the filtered doctor list) and the FavouriteServices component.
Doctor card fields
Each card in the list displays a subset of the doctor data object. The full set of fields available on every doctor record is:Identity
doctorName, department, img, genderStats
ratings, experience, reviews, availabilityProfile content
focus, profile, careerPath, highlightsInteraction state
isFavoriteDoctorInfo screen
Tapping the Info button on any doctor card navigates toDoctorInfo, passing the doctor object as item and the current pageIndex as route params. The screen opens in Info mode and shows:
- A profile card with the doctor’s photo, experience (years), focus area,
doctorName, anddepartment - Rating, review count, and availability displayed as icon-info pairs
- A Schedule button that switches the screen to calendar mode (see Appointment booking)
- Scrollable sections for Profile, Career Path, and Highlights
navigation.replace('Doctors', { selectedSort: index }), taking the user back to the DoctorsScreen with the chosen sort active.
Favouriting a doctor
The heart icon on every doctor card dispatches thetoggleFavorite async thunk. The thunk receives the full doctor object, uses doctor.id as the path parameter in the PATCH request, and flips isFavorite to its opposite value. The updated record is then merged into state.doctors.data in place.
toggleFavorite.fulfilled, the slice finds the doctor by id and merges the server response into the existing record:
useDoctors hook
A standaloneuseDoctors hook is available at src/hooks/useDoctors.js for components that need direct API access outside of Redux. It fetches the doctor list on mount and exposes an updateDoctorData helper that PATCHes a record by ID and updates local state.
Appointment screen uses this hook to access doctor data for appointment list rendering.