Regarder Réf. Courant Modifications TypeScript
const refCallback = useCallback(<T extends HTMLElement>(node: T | null) => {
if (!node) return
// do your stuff
}, [])
// use it like:
<div ref={(node) => refCallback(node)} />
T-DaMER