Skip to content

useTooltipTrigger and useButton #4206

Answered by snowystinger
Agile-fox asked this question in Q&A
Discussion options

You must be logged in to vote

Your example has spread the tooltip trigger props and the same ref onto two different components. This will cause issues. For instance, the ref will be overwritten to be whichever component mounted last, in this case, the HTML button instead of the Button component. Start by making the two different and see if that resolves your issues.

you should have something more like this, where 1 and 2 are the results of two different hook calls

let triggerRef1 = useRef();
let triggerRef2 = useRef();
  let { triggerProps1, tooltipProps1 } = useTooltipTrigger(
    props,
    state,
    triggerRef1
  );
// ... etc
      <Button ref={triggerRef1} {...triggerProps1} style={{ fontSize: 18 }}>
        But…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by snowystinger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants