cuando reviso la consola me sale:
react-dom.development.js:86 Warning: 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. Learn more: https://reactjs.org/link/switch-to-createroot Estoy usando "react-dom": "^18.0.0" , "react-router-dom": "^6.3.0" . Pero luego, cuando uso createRoot en mi index.js , no tengo el error, pero algunas funciones no funcionan (como este problema que tengo aquí )
Lo que tengo:
import "./index.css"; import App from "./App"; import React from "react"; import ReactDOM from "react-dom"; ReactDOM.render( <React.StrictMode> <App /> </React.StrictMode>, document.getElementById("root") );Lo que probé:
import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; import App from "./App"; const rootElement = document.getElementById("root"); const root = createRoot(rootElement); root.render( <StrictMode> <App /> </StrictMode> );import ReactDOM from "react-dom/client"; const root = ReactDOM.createRoot(document.getElementbyId("root") root.render(<App/>);nunca importaste reactDOM.