I really like 'react-responsive-carousel' and it perfectly fits my requirements.
More Details: https://www.npmjs.com/package/react-responsive-carousel
However I realized that the demo examples provided by this uses static images, placed in separate "Carousel.js" file.
In my case, I want to load images in Carousel, that I'm fetching using API at runtime. I don't have any clue about how can I achieve this behavior.
Currently following is the setup of my app: File: Carousel.js
import React from "react";
import { Carousel } from "react-responsive-carousel";
export default () => (
<Carousel autoPlay infiniteLoop='true'>
<div>
<img src="http://example.com/image/32.png" />
<p className="legend">Image 1</p>
</div>
<div>
<img src="http://example.com/image/34.png" />
<p className="legend">Image 2</p>
</div>
<div>
<img src="http://example.com/mockups/image/9.png" />
<p className="legend">Image 3</p>
</div>
<div>
<img src="http://example.com/image/32.png" />
<p className="legend">Image 4</p>
</div>
<div>
<img src="http://example.com/image/34.png" />
<p className="legend">Image 5</p>
</div>
</Carousel>
);
In my App.js
file, I am simply using it in the following way:
<div>
<div className="my-carousel">
<Carousel />
</div>
</div>