akiran / react-slick

React carousel component
http://react-slick.neostack.com/
MIT License
11.72k stars 2.1k forks source link

Use forwardRef to pass the ref up the component tree #1690

Open sidonaldson opened 4 years ago

sidonaldson commented 4 years ago

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?

Slowl commented 4 years ago

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()

sidonaldson commented 3 years ago

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

rfgonzalezweb commented 10 months ago

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