Skip to content
Advertisement

How do i use props & map function to insert image urls for cards with logos using React?

I am working on a personal project where NFL Data is displayed by team. I am just learning React and would like to know how to use props and map image urls from an array to display multiple NFL logo cards. I have made a similar website using strictly css, html, and javascript but need to do it in react, anyways, this is what I have:

Home.js

JavaScript

What it looks like so far

[What I want it to look like][2]

[2]: https://i.stack.imgur.com/KK0tw.jpg, except for all 32 NFL teams

Advertisement

Answer

Inside of your return you want something like this.

JavaScript

Here is an idea of what this would look like if you wanted to pass some data as props to a Card component responsible for displaying the information on each team.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement