jechav / tiny-slider-react

wrapper of tiny-slider plugin for react.
https://tiny-slider-react-tests.netlify.app/
47 stars 27 forks source link

Can't pass ref anymore? #67

Open Maclay74 opened 7 months ago

Maclay74 commented 7 months ago

For some reason I can't retrive ref from the carousel:

<TinySlider {...props} ref={ref => console.log(ref)} />

I get error saying that there is no such prop. In @types/tiny-slider-reader I don't see any ref prop available too.

If I ignore this, I get this error in browser:

Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

And if I pass it like

<TinySlider {...props} forwardedRef={ref => console.log(ref)} />

I get a reference to html element, not tiny-slider. And then application falls with error that children.length is undefined.

What am I doing wrong?