Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Can't pass ref anymore? #67

Open
Maclay74 opened this issue Apr 4, 2024 · 0 comments
Open

Can't pass ref anymore? #67

Maclay74 opened this issue Apr 4, 2024 · 0 comments

Comments

@Maclay74
Copy link

Maclay74 commented Apr 4, 2024

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant