import React from 'react'; import ReactDOM from 'react-dom/client'; import App from './App'; const mountApp = () => { const rootElement = document.getElementById('root'); if (!rootElement) { console.error("Critical: Could not find root element '#root' to mount React."); return; } try { const root = ReactDOM.createRoot(rootElement); root.render( ); console.log("React app mounted successfully."); } catch (err) { console.error("Failed to render React app:", err); } }; // Garante que o DOM está pronto antes de tentar montar if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', mountApp); } else { mountApp(); }