Obtenha a posição do elemento no React

showBanner(e) {
  const rect = this.btnDownload.current.getBoundingClientRect()

  const isInView = rect.top < window.innerHeight
  const isAtTop = rect.top <= 0

  console.log('Is in view:', isInView)
  console.log('Is at top:', isAtTop)
}
Muddy Meerkat