A component needs its own internal reference to an element while also exposing it to the parent. Merging multiple refs is not built into plain JavaScript/React.
mergeRefs(...refs) returns a callback that forwards the element to all provided refs โ object refs and callback refs alike.
This demo uses the libraryโs mergeRefs.
All components that need to expose element references (Button, Input, Dialog, etc.)