react-slick icon indicating copy to clipboard operation
react-slick copied to clipboard

methods not working (slickPrev, slickNext)

Open vivipolli opened this issue 3 years ago • 3 comments

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 avatar Mar 08 '21 15:03 vivipolli

@vivipolli removes () => from the onClick event.

it will probably solve your problem.

Tip: Use button for onClick

lucascordeiroaraujo avatar Mar 19 '21 03:03 lucascordeiroaraujo

@vivipolli did you get it to work? Having a similar issue

ursulac avatar Sep 16 '21 14:09 ursulac

Have the same issue

NataliiaDil avatar Nov 15 '21 19:11 NataliiaDil

I've created a working sample: https://codesandbox.io/s/react-slick-playground-ts-qthp90

jezmck avatar Jan 27 '23 11:01 jezmck