akiran / akiran/react-slick

React - Duplicate slider when i change infinite config

Đang mở
#1,985 0 bình luận 3 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
11.9k
Fork
2.1k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hello everyone, I'm trying to initiate the slider with `infinite: false`, and update the configuration to `infinite: true` of the slider when it is used. I then used the `beforeChange` method to update the value. It works but when the value is modified, for a few seconds the slider is displayed in duplicate.

I'm doing something wrong ?

```
constructor(props) {
super(props);
this.state = {
movies: dataMovies,
infinite: false,
};
}
```

```
render() {
const settings = {
dots: false,
infinite: this.state.infinite,
speed: 500,
slidesToShow: 5,
slidesToScroll: 5,
draggable: false,
beforeChange: (current, next) => this.setState({ infinite: true }),
};

return (



Film en tendance




{this.state.movies.map((movie) => (

))}




);
}
```

![Capture d’écran de 2021-02-08 16-08-39](https://user-images.githubusercontent.com/49270141/107239368-15fc6d00-6a29-11eb-8786-3aeb571cfbad.png)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.