Im at the beginning of react js, and im new here so sorry if I wrote the problem illegibly I would like to do Carousel using JSON.Data but only i can display one photo, i can not do sliding photos. I hope someone could help me.
data.json
{
"Slajd":[
{
"id": 1,
"name": "title",
"image": [
"https://cf.bstatic.com/images/hotel/max1024x768/263/263731269.jpg",
"https://images.pexels.com/photos/1108099/pexels-photo-1108099.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"
]
}
]
}
JSX
import React from 'react';
import { Container, Carousel, CarouselItem, CarouselProps } from 'react-bootstrap';
export function Slider({ data }) {
return(
<Carousel>
<Carousel.Item interval={1000}>
<img
className="d-block w-100"
src={data.image}
/>
</Carousel.Item>
</Carousel>
);
}
App.js
function App() {
return(
<Container>
{photo.Slajd.map(data => (
<Carousel xs={3} key={data.id}>
{data.image.map(imgSrc => (
<Slider imgSrc={imgSrc}/>
))}
</Carousel>
))}
</Container>
);
}