const { useState, useEffect } = React; function App() { const [page, setPage] = useState("home"); const [tweaks, setTweak] = useTweaks(window.__TWEAK_DEFAULTS); // Apply palette to body useEffect(() => { document.body.dataset.palette = tweaks.palette || "dourado-classico"; }, [tweaks.palette]); // If blog is hidden via flag and someone lands on it (e.g. old URL), // bounce to home so the page doesn't look orphaned. useEffect(() => { if (page === "blog" && !tweaks.showBlog) setPage("home"); }, [page, tweaks.showBlog]); return ( <>
{page === "home" && } {page === "services" && } {page === "about" && } {page === "blog" && tweaks.showBlog && } {page === "contact" && }