You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,26 @@ Isomorphic async tools for Preact.
8
8
- Generate static HTML for your app using `prerender()`, waiting for `lazy()` components and data dependencies.
9
9
- Implement async-aware client and server-side routing using `<Router>`, including seamless async transitions.
10
10
11
+
---
12
+
13
+
-[Routing](#routing)
14
+
-[Prerendering](#prerendering)
15
+
-[Nested Routing](#nested-routing)
16
+
-[API Docs](#api-docs)
17
+
-[\<LocationProvider\>](#locationprovider)
18
+
-[\<Router\>](#router)
19
+
-[\<Route\>](#route)
20
+
-[Path Segment Matching](#path-segment-matching)
21
+
-[useLocation()](#uselocation)
22
+
-[useRoute()](#useroute)
23
+
-[lazy()](#lazy)
24
+
-[\<ErrorBoundary\>](#errorboundary)
25
+
-[hydrate()](#hydrate)
26
+
-[prerender()](#prerender)
27
+
-[locationStub()](#locationstub)
28
+
29
+
---
30
+
11
31
## Routing
12
32
13
33
`preact-iso` offers a simple router for Preact with conventional and hooks-based APIs. The `<Router>` component is async-aware: when transitioning from one route to another, if the incoming route suspends (throws a Promise), the outgoing route is preserved until the new one becomes ready.
@@ -378,6 +398,18 @@ const App = () => (
378
398
const { html, links } =awaitprerender(<App />);
379
399
```
380
400
401
+
### `locationStub`
402
+
403
+
A utility function to imitate the `location` object in a non-browser environment. Our router relies upon this to function, so if you are using `preact-iso` outside of a browser context and are not prerendering via `@preact/preset-vite` (which does this for you), you can use this utility to set a stubbed `location` object.
0 commit comments