Skip to content

New reference of ref everytime useMeasure is called. #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tathagat2000 opened this issue Nov 24, 2021 · 0 comments
Open

New reference of ref everytime useMeasure is called. #64

tathagat2000 opened this issue Nov 24, 2021 · 0 comments

Comments

@tathagat2000
Copy link

// the ref we expose to the user const ref = (node: HTMLOrSVGElement | null) => { if (!node || node === state.current.element) return removeListeners() state.current.element = node state.current.scrollContainers = findScrollContainers(node) addListeners() }

Why should this functional ref, not be memoized using useCallback?
If a parent component is using useMeasure and drilling down this ref to it's children, it causes unnecessary re-renders.

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

No branches or pull requests

1 participant