import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';

const rootElement = document.getElementById('root');

// Only mount React if the root element exists.
// This allows the static index.html (which doesn't have a root div) to render
// without crashing the app script execution in preview environments.
if (rootElement) {
  const root = ReactDOM.createRoot(rootElement);
  root.render(
    <React.StrictMode>
      <App />
    </React.StrictMode>
  );
} else {
  // Silent return for static HTML strategy
  console.log("Running in static mode: React mounting skipped.");
}
