Lighttree / react-reactions

0 stars 0 forks source link

Tooltip state should be passed to only one Tooltip and TooltipReference #1

Open diegohaz opened 5 years ago

diegohaz commented 5 years ago

Hey 👋

Here you're passing the same tooltip state object to different Tooltips and TooltipReferences.

https://github.com/Lighttree/react-reactions/blob/f4a72b16005cbee7eb0b6de9d17cef16433d5662/src/components/ReactionBar.js#L1-L60

Tooltip state should be passed to only one Tooltip and TooltipReference. Otherwise, it may not work properly.

I suggest you to abstract the Reakit tooltip as described in https://reakit.io/docs/tooltip/#abstracting and use it like this:

reactions.map(reaction => {
  return (
    <Tooltip title={formatTooltipInfo(reaction.persons, personId)}>
      <ReactionGroup
        key={reaction.reaction.colons}
        reaction={reaction}
        onReactionClick={handleReactionClick}
      />
    </Tooltip>
  );
});