MDBEcommerceGallery


Topic: MDBEcommerceGallery

Konadu Kingsley pro asked 10 months ago

Cannot read properties of undefined (reading 'thumbnail') TypeError: Cannot read properties of undefined (reading 'thumbnail') at http://localhost:3000/static/js/bundle.js:36213:191 at Array.forEach () at http://localhost:3000/static/js/bundle.js:36212:17


Mateusz Lazaru staff answered 10 months ago

Thumbnail is required for imagesSrc prop objects.

Look at this demo snippet, it works in both 9.0.0 and 10.0.0 MDB React versions.

import React from 'react';
import { MDBEcommerceGallery } from 'mdb-react-ecommerce-gallery';

const basicPhotos = [
  {
    thumbnail: 'https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/1.webp',
    src: 'https://mdbcdn.b-cdn.net/img/Photos/Slides/1.webp',
    alt: 'Test alt 1',
  },
  {
    thumbnail: 'https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/2.webp',
    src: 'https://mdbcdn.b-cdn.net/img/Photos/Slides/2.webp',
    alt: 'Test alt 2',
  },
  {
    thumbnail: 'https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/3.webp',
    src: 'https://mdbcdn.b-cdn.net/img/Photos/Slides/3.webp',
    alt: 'Test alt 3',
  },
];

export default function App() {
  return <MDBEcommerceGallery imagesSrc={basicPhotos} />;
}

If you still need help, show me your code so I could help you with it.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB React
  • MDB Version: MDB5 9.0.0
  • Device: hp laptop
  • Browser: chromo
  • OS: ubuntu
  • Provided sample code: No
  • Provided link: Yes
Tags