Amateur_coder
Amateur_coder

Reputation: 91

Multiple material-ui tooltips open on click

I'm trying to use 2 Material-UI tooltips in the same parent component. Also, I need a custom control for the open and close action of the tooltips. So, I used the open and setOpen states using the UseState hook.

How can I maintain separate states for the 2 tooltips that I use, so that I can differentiate between the respective tooltip's open and close action?

Please help. Hope I made the problem statement clear.

Upvotes: 0

Views: 736

Answers (1)

Duderino9000
Duderino9000

Reputation: 2597

Create two separate state variables

const MyComponent = () => {
  const [open1, open1Set] = useState(false);
  const [open2, open2Set] = useState(false);
};

Upvotes: 2

Related Questions