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

// Use a more specific ID for WordPress integration to avoid conflicts with themes
// In standalone mode, ensure index.html has this ID or fallback to 'root'
const rootElement = document.getElementById('serobase-root') || document.getElementById('root');

if (!rootElement) {
  // In a WP environment, if the shortcode isn't present, we might not render anything,
  // preventing errors on pages where the app isn't supposed to be.
  console.log("Serobase App: Target element not found. Is the shortcode [serobase_app] present?");
} else {
  const root = ReactDOM.createRoot(rootElement);
  root.render(
    <React.StrictMode>
      <App />
    </React.StrictMode>
  );
}