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

Use forwardRef to pass the ref up the component tree

Open sidonaldson opened this issue 5 years ago • 3 comments

I'm currently trying to expose slick to my component so I can use .slick('resize').

However, the ref seems to return the ReactSlick instance itself and that doesn't seem to contain a ref to the slick instance.

React has a newish feature called forwardRef which enables a component to forward the ref down to the base component/node. Would be really useful to have this and expose the slick instance right the way up the tree.

Alternatively, does anyone know a way of exposing the slick instance or triggering the resize event?

sidonaldson avatar Dec 16 '19 11:12 sidonaldson

Did you fix your issue ?

I'm actually facing this issue on a project where I need to dynamically import react-slick, but for that I need to forward the ref to be able to use custom arrow for slickPrev() and slickNext()

Slowl avatar Jun 04 '20 12:06 Slowl

@Slowl nope, I think I resolved this by either changing carousels or changing the design so I didn't need the reference

sidonaldson avatar Oct 28 '20 13:10 sidonaldson

https://github.com/akiran/react-slick/issues/1821#issuecomment-1784017075

rfgonzalezweb avatar Oct 29 '23 07:10 rfgonzalezweb