Skip to content

Commit d4bc5c6

Browse files
committed
chore: generate markdown docs from jsdocs
1 parent 68f7f91 commit d4bc5c6

File tree

4 files changed

+170
-30
lines changed

4 files changed

+170
-30
lines changed

docs/api/data-routers/StaticRouterProvider.md

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ title: StaticRouterProvider
44

55
# StaticRouterProvider
66

7+
<!--
8+
⚠️ ⚠️ IMPORTANT ⚠️ ⚠️
9+
10+
Thank you for helping improve our documentation!
11+
12+
This file is auto-generated from the JSDoc comments in the source
13+
code, so please edit the JSDoc comments in the file below and this
14+
file will be re-generated once those changes are merged.
15+
16+
https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/dom/server.tsx
17+
-->
18+
719
[MODES: data]
820

921
## Summary
@@ -13,28 +25,44 @@ title: StaticRouterProvider
1325
A Data Router that may not navigate to any other location. This is useful
1426
on the server where there is no stateful UI.
1527

16-
## Props
28+
```tsx
29+
export async function handleRequest(request: Request) {
30+
let { query, dataRoutes } = createStaticHandler(routes);
31+
let context = await query(request));
1732

18-
### context
33+
if (context instanceof Response) {
34+
return context;
35+
}
1936

20-
[modes: data]
37+
let router = createStaticRouter(dataRoutes, context);
38+
return new Response(
39+
ReactDOMServer.renderToString(<StaticRouterProvider ... />),
40+
{ headers: { "Content-Type": "text/html" } }
41+
);
42+
}
43+
```
2144

22-
_No documentation_
45+
## Signature
2346

24-
### hydrate
47+
```tsx
48+
function StaticRouterProvider({ context, router, hydrate = true, nonce, }: StaticRouterProviderProps)
49+
```
50+
51+
## Props
2552

26-
[modes: data]
53+
### context
2754

28-
_No documentation_
55+
The [`StaticHandlerContext`](https://api.reactrouter.com/v7/interfaces/react_router.StaticHandlerContext.html) returned from `staticHandler.query()`
2956

30-
### nonce
57+
### router
3158

32-
[modes: data]
59+
The static data router from [`createStaticRouter`](../data-routers/createStaticRouter)
3360

34-
_No documentation_
61+
### hydrate
3562

36-
### router
63+
Whether to hydrate the router on the client (default `true`)
64+
65+
### nonce
3766

38-
[modes: data]
67+
The [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce) to use for the hydration `<script>` tag
3968

40-
_No documentation_
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: createStaticHandler
3+
---
4+
5+
# createStaticHandler
6+
7+
<!--
8+
⚠️ ⚠️ IMPORTANT ⚠️ ⚠️
9+
10+
Thank you for helping improve our documentation!
11+
12+
This file is auto-generated from the JSDoc comments in the source
13+
code, so please edit the JSDoc comments in the file below and this
14+
file will be re-generated once those changes are merged.
15+
16+
https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/dom/server.tsx
17+
-->
18+
19+
[MODES: data]
20+
21+
## Summary
22+
23+
[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.createStaticHandler.html)
24+
25+
Create a static handler to perform server-side data loading
26+
27+
```tsx
28+
export async function handleRequest(request: Request) {
29+
let { query, dataRoutes } = createStaticHandler(routes);
30+
let context = await query(request));
31+
32+
if (context instanceof Response) {
33+
return context;
34+
}
35+
36+
let router = createStaticRouter(dataRoutes, context);
37+
return new Response(
38+
ReactDOMServer.renderToString(<StaticRouterProvider ... />),
39+
{ headers: { "Content-Type": "text/html" } }
40+
);
41+
}
42+
```
43+
44+
## Signature
45+
46+
```tsx
47+
function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions)
48+
```
49+
50+
## Params
51+
52+
### routes
53+
54+
The route objects to create a static handler for
55+
56+
### opts.basename
57+
58+
The base URL for the static handler (default: `/`)
59+
60+
### opts.future
61+
62+
Future flags for the static handler
63+
64+
## Returns
65+
66+
A static handler that can be used to query data for the provided routes
67+

docs/api/data-routers/createStaticRouter.md

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,66 @@ title: createStaticRouter
44

55
# createStaticRouter
66

7+
<!--
8+
⚠️ ⚠️ IMPORTANT ⚠️ ⚠️
9+
10+
Thank you for helping improve our documentation!
11+
12+
This file is auto-generated from the JSDoc comments in the source
13+
code, so please edit the JSDoc comments in the file below and this
14+
file will be re-generated once those changes are merged.
15+
16+
https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/dom/server.tsx
17+
-->
18+
719
[MODES: data]
820

921
## Summary
1022

1123
[Reference Documentation ↗](https://api.reactrouter.com/v7/functions/react_router.createStaticRouter.html)
1224

25+
Create a static data router for server-side rendering
26+
27+
```tsx
28+
export async function handleRequest(request: Request) {
29+
let { query, dataRoutes } = createStaticHandler(routes);
30+
let context = await query(request));
31+
32+
if (context instanceof Response) {
33+
return context;
34+
}
35+
36+
let router = createStaticRouter(dataRoutes, context);
37+
return new Response(
38+
ReactDOMServer.renderToString(<StaticRouterProvider ... />),
39+
{ headers: { "Content-Type": "text/html" } }
40+
);
41+
}
42+
```
43+
1344
## Signature
1445

1546
```tsx
16-
createStaticRouter(routes, context, opts): DataRouter
47+
function createStaticRouter(routes: RouteObject[], context: StaticHandlerContext, opts: {
48+
future?: Partial<FutureConfig>;
49+
} = {}): DataRouter
1750
```
1851

1952
## Params
2053

2154
### routes
2255

23-
[modes: data]
24-
25-
_No documentation_
56+
The route objects to create a static data router for
2657

2758
### context
2859

29-
[modes: data]
60+
The static handler context returned from `staticHandler.query()`
61+
62+
### opts.future
3063

31-
_No documentation_
64+
Future flags for the static data router
3265

33-
### opts
66+
## Returns
3467

35-
[modes: data]
68+
A static data router that can be used to render the provided routes
3669

37-
_No documentation_

docs/api/declarative-routers/StaticRouter.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ title: StaticRouter
44

55
# StaticRouter
66

7+
<!--
8+
⚠️ ⚠️ IMPORTANT ⚠️ ⚠️
9+
10+
Thank you for helping improve our documentation!
11+
12+
This file is auto-generated from the JSDoc comments in the source
13+
code, so please edit the JSDoc comments in the file below and this
14+
file will be re-generated once those changes are merged.
15+
16+
https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/dom/server.tsx
17+
-->
18+
719
[MODES: declarative]
820

921
## Summary
@@ -13,22 +25,23 @@ title: StaticRouter
1325
A `<Router>` that may not navigate to any other location. This is useful
1426
on the server where there is no stateful UI.
1527

28+
## Signature
29+
30+
```tsx
31+
function StaticRouter({ basename, children, location: locationProp = "/", }: StaticRouterProps)
32+
```
33+
1634
## Props
1735

1836
### basename
1937

20-
[modes: declarative]
21-
22-
_No documentation_
38+
The base URL for the static router (default: `/`)
2339

2440
### children
2541

26-
[modes: declarative]
27-
28-
_No documentation_
42+
The child elements to render inside the static router
2943

3044
### location
3145

32-
[modes: declarative]
46+
The location to render the static router at (default: `/`)
3347

34-
_No documentation_

0 commit comments

Comments
 (0)