Click events don't work on dropdowns in React (with vite)
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
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 thanks for you solution, I hope it can be fixed in the future. I decided to use other framework https://www.vechaiui.com