Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-slick reinit

I'm using react-slick slider and can't figure out how I can re-initialize the slider. With the jquery slick plugin, I can call $slick.reInit(), but using react I can't seem to do this. Is there something similar I can do in react to the reinit method?

like image 992
Jwill Avatar asked Nov 24 '16 20:11

Jwill


1 Answers

There is no such feature for now, but there is a way to do it.

If you wrap Slick with a component and give it a unique key, slick reloads each time the key changes

render: function() {
    return <div key={uniqueId}>
               <CarouselComponent>
           </div>;
}
like image 178
Yasin UYSAL Avatar answered Sep 18 '22 09:09

Yasin UYSAL