akiran / akiran/react-slick

React - Duplicate slider when i change infinite config

未关闭
#1,985 0 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
11.9k
派生
2.1k
PR 合并指标
30 天内没有已合并 PR

描述

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)

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。