8000 GitHub - cultureic/BSWH-entry-test: react native code challenge as entry to BSWH
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

cultureic/BSWH-entry-test

Repository files navigation

Introduction

This is a React Native project that displays a list of users and their associated albums. The project uses the react-native library to create a native mobile app, and the redux library to manage application state.

Components

The following components are used in the project:

  • Section: A component that wraps the Text component and displays a title and description.
  • UserList: A component that displays a list of users.
  • PhotoGrid: A component that displays an album of photos.

Functions

The following functions are defined in the project:

  • fetchUsersAsync: An asynchronous function that fetches a list of users from an API.
  • fetchAlbumsAsync: An asynchronous function that fetches a list of albums for each user from an API.
  • setUserList: A reducer function that sets the users state to the list of users returned by the fetchUsersAsync function.
  • setUserAlbums: A reducer function that sets the albums state to the list of albums returned by the fetchAlbumsAsync function for each user.

Reducers

The following reducers are defined in the project:

  • usersReducer: A reducer function that handles state for the list of users.
  • albumsReducer: A reducer function that handles state for the list of albums.

Store

The project uses the configureStore function from the reduxjs library to create a store with the following reducers:

  • usersReducer: A reducer function that handles state for the list of users.
  • albumsReducer: A reducer function that handles state for the list of albums.

Thunks

The project defines the following thunks:

  • fetchUsersAsync: An asynchronous thunk that fetches a list of users from an API.

  • fetchAlbumsAsync: An asynchronous thunk that fetches a list of albums for each user from an API.

  • fetchAllPhotosAsync: An asynchronous thunk that fetches a list of photos for all albums from an API.

  • fetchPhotosByAlbumIdAsync: An asynchronous thunk that fetches a list of photos for a specific album from an API.

Actions

The project defines the following actions:

  • setUserList: An action that sets the users state to the list of users returned by the fetchUsersAsync function.
  • setUserAlbums: An action that sets the albums state to the list of albums returned by the fetchAlbumsAsync function for each user.
  • setAllPhotos: An action that sets the allphotos state to the list of photos returned by the fetchAllPhotosAsync function.
  • setCurrentAlbum: An action that sets the currentAlbum state to the album returned by the fetchPhotosByAlbumIdAsync function.
  • toggleDisplayMode: An action that toggles the display mode of the photos (whether to show all photos or the current album).

Selectors

The project defines the following selectors:

  • selectUsers: A selector that returns the list of users.
  • selectUserAlbums: A selector that returns the list of albums for each user.
  • selectAllPhotos: A selector that returns the list of photos for all albums.
  • selectCurrentAlbum: A selector that returns the album currently being displayed.

App

The project exports a single component, App, which renders the Section component with the UserList and PhotoGrid components as children. The App component also uses the store function to create a store with the usersReducer and albumsReducer reducers.

Conclusion

This project is a basic example of how to use React Native and Redux together to build a mobile app that displays a list of users and their associated albums. Of course, this is just the tip of the iceberg when it comes to building complex applications with React Native and Redux, but hopefully this documentation will give you a good starting point for your own project.

About

react native code challenge as entry to BSWH

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0