Closed Gautam-Arora24 closed 2 years ago
It was discussed in this issue https://github.com/maslianok/react-resize-detector/issues/130
You'll get the bug described in the issue if you remove the ref.current
from the dependency array. I put some time to fix the bug and I couldn't find a better approach to resolve it (please read my comment here https://github.com/maslianok/react-resize-detector/issues/130#issuecomment-775046806)
Thank you for the feedback. Please let me know if you have any further questions
The library has
ref.current
as a useEffect hook dependency here which I think is of no use.Why I came to this conclusion? I was implementing my own hook on top of ResizeObserverAPI and after adding
ref.current
in useEffect hook as a dependency I am getting an eslint warning which states thatMutable values like 'ref.current' aren't valid dependencies because mutating them doesn't re-render the component. (react-hooks/exhaustive-deps)