import React from "react"; import { createRoot } from "react-dom/client"; import App from "./App"; import "./index.css"; // Find the root element or create one if missing const mount = () => { let rootElement = document.getElementById("root"); if (!rootElement) { console.error("Root element not found, creating one"); rootElement = document.createElement("div"); rootElement.id = "root"; document.body.appendChild(rootElement); } return rootElement; }; const root = createRoot(mount()); root.render( );