The goal of this coding exam is to quickly get you off the ground with setState Callback Function.
Failure View
Click to view
Click to view
- Download dependencies by running
npm install - Start up the app using
npm start
Functionality to be added
The app must have the following functionalities
-
When the app is opened initially,
- An HTTP GET request should be made to projectsApiUrl with query parameter as
categoryand its initial value asALL - The loader should be displayed while fetching the data
- After the data is fetched successfully, display the projects list received in the API response
- An HTTP GET request should be made to projectsApiUrl with query parameter as
-
When a category option is selected,
- An HTTP GET request should be made to the projectsApiUrl with the query parameter as
categoryand its value as theidof the active category option - The loader should be displayed while fetching the data
- After the data is fetched successfully, display the projects list received in the API response
- An HTTP GET request should be made to the projectsApiUrl with the query parameter as
-
The
Appcomponent is provided withcategoriesList. It consists of a list of category objects with the following properties in each category objectKey Data Type id String displayText String
API Requests & Responses
projectsApiUrl
Returns a response containing the list of all projects
{
"projects": [
{
"id": "f680c5fb-a4d0-4f43-b356-785d920208df",
"name": "Music Page",
"image_url": "https://assets.ccbp.in/frontend/react-js/projects-showcase/music-page-img.png"
},
...
],
"total": 34
}Click to view
The following instructions are required for the tests to pass
- Each category option in the HTML
selectelement should have the value attribute as the value of keyidand text content as the value of the keydisplayTextfrom thecategoriesListprovided - Wrap the
Loadercomponent with an HTML container element and add thedata-testidattribute value as loader to it - The project image in each project item should have the alt as the value of the key
namefrom each project object in the projects API response
Image URLs
- https://assets.ccbp.in/frontend/react-js/projects-showcase/website-logo-img.png alt should be website logo
- https://assets.ccbp.in/frontend/react-js/projects-showcase/failure-img.png alt should be failure view
Colors
Font-families
- Roboto
- All components you implement should go in the
src/componentsdirectory.- Don't change the component folder names as those are the files being imported into the tests.
