akiran / akiran/react-slick

React - Duplicate slider when i change infinite config

Abierto
#1,985 0 comentarios 3 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
11.9k
Forks
2.1k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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)

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.