const App = () => { const [ready, setReady] = React.useState(false); const [active, setActive] = React.useState("inicio"); React.useEffect(() => { window.__sbLoadPLData().finally(() => setReady(true)); }, []); React.useEffect(() => { if (!ready) return; const ids = ["inicio", "nosotros", "contacto"]; const obs = new IntersectionObserver((entries) => { entries.forEach(e => { if (e.isIntersecting) setActive(e.target.id); }); }, { rootMargin: "-40% 0px -55% 0px", threshold: 0 }); ids.forEach(id => { const el = document.getElementById(id); if (el) obs.observe(el); }); return () => obs.disconnect(); }, [ready]); if (!ready) { return (
Psicología Libros
Cargando…
); } return (
); }; ReactDOM.createRoot(document.getElementById("root")).render();