Олексій, I suppose then this logic should live inside your component with dynamic targets. You can choose where you want to put targetRef from hook depending on something <MyElement ref={isSomething ? tagetRef : undefined}.
Other option is to slightly tweak the hook, so it will accepts the target ref as a prop, i.e. usage would be const {width, height} = useElementSize(myElementRef). But still you have to make myElementRef to be dynamic inside your component.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Олексій, I suppose then this logic should live inside your component with dynamic targets. You can choose where you want to put
targetRef
from hook depending on something<MyElement ref={isSomething ? tagetRef : undefined}
.Other option is to slightly tweak the hook, so it will accepts the target ref as a prop, i.e. usage would be
const {width, height} = useElementSize(myElementRef)
. But still you have to makemyElementRef
to be dynamic inside your component.