In this exercise, the goal is ProStar in react:
- props and state,
- event handlers
- Fork this repo
- Clone this repo
Whenever you create a first significant change, you should make your first commit.
- Follow these guidelines to add, commit and push changes.
In the end of this document, you will find guidelines on how to submit the exercise.
Let's take a look at the starter code.
Inside resource
folder, you can find prostar.json
, a JSON file with the producer's contacts. Import this file and create an array of the 5 first star celebrities to use as your initial state.
Display that array of 5 prostar in a <table>
and display the picture
, name
, and popularity
of each contact.
To import prostar.json
in App.js
, you can simply use:
import prostar from './prostar.json'
At the end of this iteration, your application should look like this:
In your application, create a "Add Random Prostart button so that every time you click on this button it adds a new random actor.
First randomly select a prostars from the larger prostars
array. Then add that prostar the array of 5 in your state. Don't forget to setState()
to cause React to re-render the app.
At the end of this iteration, your website will probably look like this:
The producer asked you to add two new buttons to help them to sort their prostars. When you click on one of the buttons it should sort the table by name
(alphabetically) and when click the other it should sort by popularity
(highest first).
Don't forget to setState()
after you sort!
This is what you may have at the end of this iteration:
The producer asked you to add two new buttons to help them to sort their prostars. When you click on one of the buttons it should sort by popularity
(highest first).
Don't forget to setState()
after you sort!
This is what you may have at the end of this iteration:
The producer also would like to remove some of their prostars. Implement a "Delete" button on each row of your <table>
that will let the user remove the contact they clicked.
When they click, you should get the index of the array of that actor and use it to remove the contact from the array. Don't forget to setState()
after you remove the prostars!
At the end of this iteration, your web page may look like this after playing a little bit with the "Delete" buttons.
If you didn't add, commit and push the changes you made, this is the last call. ๐
please share your github links with your Mentors. Your Mentor's will check up your work and provide feedback.
If you managed to do it, good job! ๐
We are proud of you!
Happy Coding ProGrad โค๏ธ!