In a React project, I have Carousel installed from 'react-responsive-carousel' npm package. In that I want to redirect to some component on click of images sliding in it. How could be it done
const data = [
{
img:
"https://images.pexels.com/photos/736230/pexels-photo-736230.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"
},
{
img:
"https://cdn.pixabay.com/photo/2015/04/19/08/32/marguerite-729510__340.jpg"
},
{
img:
"https://cdn.pixabay.com/photo/2015/04/19/08/33/flower-729512__340.jpg"
},
{
img:
"https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/sunflower-1508785046.jpg"
}
];
<Carousel autoPlay infiniteLoop showArrows={false} showThumbs={false}>
{data.map((item) => (
<Link to="/images">
<img src={item.img} />
</Link>
))}
</Carousel>
Below is the link for CodeSandbox for better clarity CodeSandbox Link: https://codesandbox.io/s/sad-sea-1ptl3