1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-31 06:18:07 +00:00
_/wmr/public/index.js

33 lines
847 B
JavaScript
Raw Normal View History

2021-04-20 19:11:14 +09:00
import hydrate from "preact-iso/hydrate";
import { LocationProvider, Router } from "preact-iso/router";
import lazy, { ErrorBoundary } from "preact-iso/lazy";
import Home from "./pages/home/index.js";
import NotFound from "./pages/_404.js";
import Header from "./header.js";
const About = lazy(() => import("./pages/about/index.js"));
export function App() {
return (
<LocationProvider>
<div class="app">
<Header />
<ErrorBoundary>
<Router>
<Home path="/" />
<About path="/about" />
<NotFound default />
</Router>
</ErrorBoundary>
</div>
</LocationProvider>
);
}
hydrate(<App />);
export async function prerender(data) {
const { default: prerender } = await import("preact-iso/prerender");
return await prerender(<App {...data} />);
}