akiran / akiran/react-slick

React - Duplicate slider when i change infinite config

Aperta
#1,985 0 commenti 3 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
11.9k
Fork
2.1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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)

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.