Quantcast
Viewing all articles
Browse latest Browse all 6405

how to check the height of my component with hook ref from react?

I'm trying to check if the height of my button is 50 to display a different spinner but even the height being 50 displays SpinnerTwo, does anyone know the problem?

const refButton = useRef<HTMLButtonElement | null>(null);    <Button ref={refButton} onClick={onClick} >   {ref.current?.clientHeight === 50 ? <SpinnerOne /> : <SpinnerTwo />}</Button>

Viewing all articles
Browse latest Browse all 6405

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>