git checkout step2
- component lists
- props validation
- using dynamic class
- Find tag that has
bookshelf-item
class ( insidesrc/js/components/Bookshelf.js
) - Map
props.books
array to array of tags like in following example:
const tagArray = dataArray.map((item, idx) => <tag key={idx}>{item.data}</tag >;
- Use found tag as template
- NOTE: make sure you add key attribute with unique value (e.g. index, bookId) to the root tag of each item
- Replace found tag with generated array of tags like following:
{tagArray}
You should see list of book cards
- Add
propTypes
to BookCard component (for reference seepropTypes
insidesrc/js/components/Bookshelf.js
)
There are no visual effects :-(
- Find tag that renders rating in BookCard component. It should have the class
rating
- Modify it so it will have additional class with name
rating-#
, where # is the numeric value ofprops.rating
(e.g.rating-4
)- for reference see
layout
insidesrc/js/components/Bookshelf.js
- for reference see
You should see green stars for books that have rating ★★★
####step 1
- making a react simple component
- making a react component
- jsx basics
- components props
####step 3
- using events
- using component state
- using dynamic local style