ideas
ideas copied to clipboard
usePosition
A simple hook to get position of a element
function App() {
let ref = useRef(null);
let { left, top } = usePosition(ref);
return (
<p ref={ref}>Hello Hooks: {JSON.stringify({left, top})}</p>
);
}
here my repo: https://github.com/tranbathanhtung/usePosition