From the course: Rendering Data in React
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Solution: Using map to render arrays - React.js Tutorial
From the course: Rendering Data in React
Solution: Using map to render arrays
- [Instructor] All right, so your task is to go ahead and render a list of books. Here we have deep book details and this we can use for rendering each book. Here is our array of books, and our solution code goes here. As you can see, on the left the books are appearing. What am I doing? Well, I'm using the map methods on our books array, and for every book I'm going to use the component book details and I'm passing in the book ID as the unique key and the book has the property book, which we're then using in the book details to render the details of the book. Let's go ahead and verify our codes. And as you can see, it doesn't only look good, but the tests are passing, as well. And this is one way to render a list of books.