import React, { lazy, Suspense } from 'react' import { createRoot } from 'react-dom/client' // Sub-section components — lazy-loaded so only the hero blocks the initial bundle import HomeHero from './HomeHero' const HomeTrending = lazy(() => import('./HomeTrending')) const HomeFresh = lazy(() => import('./HomeFresh')) const HomeTags = lazy(() => import('./HomeTags')) const HomeCreators = lazy(() => import('./HomeCreators')) const HomeNews = lazy(() => import('./HomeNews')) function SectionFallback() { return (
) } function HomePage({ hero, trending, fresh, tags, creators, news }) { return (
{/* Hero — above-fold, eager */} {/* Below-fold sections — lazy */} }> }> }> }> }>
) } // Auto-mount when the Blade view provides #homepage-root const mountEl = document.getElementById('homepage-root') if (mountEl) { let props = {} try { const propsEl = document.getElementById('homepage-props') props = propsEl ? JSON.parse(propsEl.textContent || '{}') : {} } catch { props = {} } createRoot(mountEl).render() } export default HomePage