React Tooltip doesn’t closes when using settimeout

  Kiến thức lập trình

I’m trying to show a tooltip open by default when the component mounts and then close it after 3 seconds using setState and the defaultIsOpen prop. However, the tooltip remains visible after 3 seconds. Here’s the CodeSandbox link . Any idea what I’m missing?

Defaultopen is not reactive which means it only takes the value at first render only so when you change the value later it will not react, you should instead use open prop which is reactive

New contributor

user37239 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT