flowbite icon indicating copy to clipboard operation
flowbite copied to clipboard

Click events don't work on dropdowns in React (with vite)

Open ebarquero85 opened this issue 4 years ago • 3 comments

Hi, this is a example of a vite react app, I try to use a dropdown menu and it doesn't work. I dotn't now what I am doing wrong. Same scenario with other components that need some kind of event with click like tooltip, etc.

https://github.com/ebarquero85/test-flowbite/blob/main/src/App.jsx https://github.com/ebarquero85/test-flowbite

ebarquero85 avatar Aug 30 '22 04:08 ebarquero85

I have the same problem. In your main.tsx, you can make the following changes:

  • import ReactDOM from "react-dom/client" by ReactDOM from "react-dom" and
  • ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( <React.StrictMode> </React.StrictMode> ) by ReactDOM.render( <React.StrictMode> </React.StrictMode>, document.getElementById("root") )

That's works, but isn't a good "solution", because in the browser console appears the error: "ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17".

So, I'm still looking for a real solution :(

matheus-omena avatar Aug 30 '22 21:08 matheus-omena

@matheus-omena thanks for you solution, I hope it can be fixed in the future. I decided to use other framework https://www.vechaiui.com

ebarquero85 avatar Aug 31 '22 14:08 ebarquero85

Hello everyone,

For React, it's probably best to use the Flowbite React library.

zoltanszogyenyi avatar Sep 06 '22 07:09 zoltanszogyenyi