J
J
jeka-32019-05-12 13:52:26
React
jeka-3, 2019-05-12 13:52:26

How to add images via props to React Carousel Image Gallery?

How to add images via props to React Carousel Image Gallery ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Ostic, 2019-05-12
@jeka-3

import ImageGallery from 'react-image-gallery';
 
class MyComponent extends React.Component {
 render() {
     return (
      <ImageGallery items={images} />
    );
  }
 
}

where images
const images = [
  {
    original: 'http://lorempixel.com/1000/600/nature/1/',
    thumbnail: 'http://lorempixel.com/250/150/nature/1/',
  },
 {
   original: 'http://lorempixel.com/1000/600/nature/2/',
   thumbnail: 'http://lorempixel.com/250/150/nature/2/'
 },
{
   original: 'http://lorempixel.com/1000/600/nature/3/',
   thumbnail: 'http://lorempixel.com/250/150/nature/3/'
 }
]

it's all there in the doc...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question