Why don't you use react-id-swiper to show the effect of swiping like the official website demo?

ask for advice, when I use react-id-swiper, I will not show the effect of swiping like the official website demo, but all div will be squeezed into the first block?

reference

official website codepen code: https://codepen.io/stinaq/pen.
npm react-id-swiper: https://www.npmjs.com/package.
github react-id-swiper: https://github.com/kidjp85/re.
react-id-swiper effect demo: http://kidjp85.github.io/reac.

Picture

clipboard.png

Code

class SwiperDemo extends Component {

constructor(props) {
    super(props)
    this.state = {
    }
}

render() {
    const params = {
        pagination: {
            el: ".swiper-pagination",
            type: "bullets",
            clickable: true
        },
        navigation: {
            nextEl: ".swiper-button-next",
            prevEl: ".swiper-button-prev"
        },
        spaceBetween: 30
    }
    
    return (
        <div>
            <ReactIdSwiper {...params}>
                <div className="slide1">Slide 1</div>
                <div className="slide2">Slide 2</div>
                <div>Slide 3</div>
                <div>Slide 4</div>
                <div>Slide 5</div>
            </ReactIdSwiper>
        </div>
    );
}

}

/ / export default swiper demo
export default SwiperDemo

which god can help explain why it is written entirely in accordance with the official website demo, but the local test does not show the desired results? Thank you very much!

Jul.26,2021

you also have to import swiper styles

import 'react-id-swiper/src/styles/css/swiper.css';

swiper has its own style. To quote


, try react-awesome-swiper

.
Menu