feat: add context information to render function (#46)

This commit is contained in:
Luca Casonato
2021-08-06 18:08:48 +02:00
committed by GitHub
parent 3bce2fb8d3
commit 0777c1c7ba
9 changed files with 116 additions and 61 deletions
+15
View File
@@ -1,4 +1,19 @@
export interface PageProps {
/** The URL of the request that resulted in this page being rendered. */
url: URL;
/** The route matcher (e.g. /blog/:id) that the request matched for this page
* to be rendered. */
route: string;
/**
* The paramteres that were matched from the route.
*
* For the `/foo/:bar` route with url `/foo/123`, `params` would be
* `{ bar: '123' }`. For a route with no matchers, `params` would be `{}`. For
* a wildcard route, like `/foo/:path*` with url `/foo/bar/baz`, `params` would
* be `{ path: [ 'bar', 'baz' ] }`.
*/
params: Record<string, string | string[]>;
}