react-slick
react-slick copied to clipboard
methods not working (slickPrev, slickNext)
Any ideia?
const slickRef = useRef();
const handlePage = (way) => {
if (way === 'back') {
slickRef.current.slickPrev();
} else {
slickRef.current.slickNext();
}
};
<Slider ref={slickRef} {...settings}>
<Card>
<p>Nome da Campanha que tem os clientes...</p>
...
</Card>
<Card>
<p>Nome da Campanha que tem os clientes...</p>
...
</Card>
<Card>
<p>Nome da Campanha que tem os clientes...</p>
...
</Card>
<Card>
<p>Nome da Campanha que tem os clientes...</p>
...
</Card>
</Slider>
<Pagination>
<img onClick={() => handlePage('back')} src={backIcon} alt="" />
<span>pagination</span>
<img onClick={() => handlePage('next')} src={nextIcon} alt="" />
</Pagination>
@vivipolli removes () =>
from the onClick event.
it will probably solve your problem.
Tip: Use button
for onClick
@vivipolli did you get it to work? Having a similar issue
Have the same issue
I've created a working sample: https://codesandbox.io/s/react-slick-playground-ts-qthp90