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
category
and 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
category
and its value as theid
of 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
App
component 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
select
element should have the value attribute as the value of keyid
and text content as the value of the keydisplayText
from thecategoriesList
provided - Wrap the
Loader
component with an HTML container element and add thedata-testid
attribute value as loader to it - The project image in each project item should have the alt as the value of the key
name
from 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
Hex: #f1f5f9
Hex: #cbd5e1
Hex: #475569
Hex: #ffffff
Hex: #328af2
Hex: #e2e8f0
Hex: #e6e9ec
Font-families
- Roboto
- All components you implement should go in the
src/components
directory.- Don't change the component folder names as those are the files being imported into the tests.