3 ms·
Using refs to talk to the DOM is a leaky abstraction, but talking the the DOM is a necessity in a framework that renders to the DOM. Before forwardRef, you'd e
by bsimpson 9y ago
Using refs to talk to the DOM is a leaky abstraction, but talking the the DOM is a necessity in a framework that renders to the DOM. Before forwardRef, you'd end up with ad-hoc prop names like `domRef` to try to wallpaper around the leak.
I'm happy to see a thoughtful solution. There are some things you just can't do with React alone (like listen for PointerEvents).
- joshribakoff 9y agoYou can handle pointer events with synthetic events (onMouseMove and such) unless I am misunderstanding
- bsimpson 9y agoI mean PointerEvent, not MouseEvent: https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent https://developer.mozilla.org/en-US/docs/Web/API/PointerEven...