plougsgaard / react-timeout

Component wrapper for setTimeout et al that cleans up after itself.
127 stars 17 forks source link

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

Closed ishantsolanki closed 4 years ago

ishantsolanki commented 4 years ago

I am getting this error whenever reactTimeout wrapped component renders.

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

Check the render method of `ReactTimeout`.

Looking at the code, i found that this method mentioned below isnt being used anywhere? Is there anything that we are doing with the ref? https://github.com/plougsgaard/react-timeout/blob/45dad3061ae65882fcbd531871b777cdfdcebec2/src/reactTimeout.js#L82

If not, we can remove the ref and in turn resolve this error.

plougsgaard commented 4 years ago

Apologies for the late reply - it's finally fixed in version 2.0.0.