I am trying to implement a List view in React. What I am trying to achieve is that to store the list headers informations and register the components and register the scroll ev
I do realize that the author asks question in relation to a class-based component, however I think it's worth mentioning that as of React 16.8.0 (February 6, 2019) you can take advantage of hooks in function-based components.
Example code:
import { useRef } from 'react'
function Component() {
const inputRef = useRef()
return (
{
const { offsetTop } = inputRef.current
...
}}
>
)
}