/react-mapping-array-kennylee-cintron

react-mapping-array-kennylee-cintron created by GitHub Classroom

Primary LanguageHTML

mapping array of objects

  • create a new react app using: npx create-react-app 'app-name'.
  • map this array in App.js to display it's content:
const products = [
    { name: "xbox", price: "400€", image: "https://picsum.photos/300/200" },
    {
      name: "PlayStation",
      price: "550€",
      image: "https://picsum.photos/300/200",
    },
    { name: "Nintendo", price: "200€", image: "https://picsum.photos/300/200" },
  ];
  • add some styling to match the picture:

React

Note: we're using https://picsum.photos/ to generate random pictures and not the actual pictures.