const { Carousel, CarouselItem, CarouselControl, CarouselIndicators, CarouselCaption } = Reactstrap;
const items = [
{
src: ‘https://via.placeholder.com/800×400’,
altText: ‘Slide 1’,
caption: ‘Slide 1’
},
{
src: ‘https://via.placeholder.com/800×400’,
altText: ‘Slide 2’,
caption: ‘Slide 2’
},
{
src: ‘https://via.placeholder.com/800×400’,
altText: ‘Slide 3’,
caption: ‘Slide 3’
}
];
class Example extends React.Component {
constructor(props) {
super(props);
this.state = { activeIndex: 0 };
this.next = this.next.bind(this);
this.previous = this.previous.bind(this);
this.goToIndex = this.goToIndex.bind(this);
}
next() {
const nextIndex = this.state.activeIndex === items.length – 1 ? 0 : this.state.activeIndex + 1;
this.setState({ activeIndex: nextIndex });
}
previous() {
const nextIndex = this.state.activeIndex === 0 ? items.length – 1 : this.state.activeIndex – 1;
this.setState({ activeIndex: nextIndex });
}
goToIndex(newIndex) {
this.setState({ activeIndex: newIndex });
}
render() {
const { activeIndex } = this.state;
const slides = items.map(item => {
return (
{}}>
);
});
return (
{
`.custom-tag {
max-width: 100%;
height: 500px;
}
}`
}
{slides}
);
}
}
ReactDOM.render(, document.getElementById(‘root’));
what is the use of mock.js, i can put the link of tihe image directly without this file right?
Es lo que buscaba, gracias
thanks! realized its important to install "react-bootstrap" in the appropriate folder. My project has two package.json's at different levels. The root level json was not reached. needed to activate the command in my "client"/"frontend" folder
Nice, how to change the carousel size or the images?
Cheers.
Thank you very much! You helped me a lot fr!! Bless you!