File tree Expand file tree Collapse file tree 6 files changed +99
-9
lines changed Expand file tree Collapse file tree 6 files changed +99
-9
lines changed Original file line number Diff line number Diff line change @@ -3,15 +3,30 @@ title: RSCHydratedRouter
3
3
unstable : true
4
4
---
5
5
6
- # RSCHydratedRouter
6
+ # unstable_RSCHydratedRouter
7
7
8
8
[ MODES: data]
9
9
10
+ <br />
11
+ <br />
12
+
13
+ <docs-warning >This API is experimental and subject to breaking changes in
14
+ minor/patch releases. Please use with caution and pay ** very** close attention
15
+ to release notes for relevant changes.</docs-warning >
16
+
10
17
## Summary
11
18
12
19
Hydrates a server rendered ` RSCPayload ` in the browser.
13
20
14
- ``` tsx filename=entry.browser.tsx lines=[7-12]
21
+ ``` tsx filename=entry.browser.tsx
22
+ import { startTransition , StrictMode } from " react" ;
23
+ import { hydrateRoot } from " react-dom/client" ;
24
+ import {
25
+ unstable_getRSCStream as getRSCStream ,
26
+ unstable_RSCHydratedRouter as RSCHydratedRouter ,
27
+ } from " react-router" ;
28
+ import type { unstable_RSCPayload as RSCPayload } from " react-router" ;
29
+
15
30
createFromReadableStream (getRSCStream ()).then (
16
31
(payload : RSCServerPayload ) => {
17
32
startTransition (async () => {
Original file line number Diff line number Diff line change @@ -3,15 +3,30 @@ title: RSCStaticRouter
3
3
unstable : true
4
4
---
5
5
6
- # RSCStaticRouter
6
+ # unstable_RSCStaticRouter
7
7
8
8
[ MODES: data]
9
9
10
+ <br />
11
+ <br />
12
+
13
+ <docs-warning >This API is experimental and subject to breaking changes in
14
+ minor/patch releases. Please use with caution and pay ** very** close attention
15
+ to release notes for relevant changes.</docs-warning >
16
+
10
17
## Summary
11
18
12
19
Pre-renders an ` RSCPayload ` to HTML. Usually used in ` routeRSCServerRequest ` 's ` renderHTML ` callback.
13
20
14
- ``` tsx filename=entry.ssr.tsx lines=[9]
21
+ ``` tsx filename=entry.ssr.tsx
22
+ import { createFromReadableStream } from " @vitejs/plugin-rsc/ssr" ;
23
+ // @ts-expect-error
24
+ import * as ReactDomServer from " react-dom/server.edge" ;
25
+ import {
26
+ unstable_RSCStaticRouter as RSCStaticRouter ,
27
+ unstable_routeRSCServerRequest as routeRSCServerRequest ,
28
+ } from " react-router" ;
29
+
15
30
routeRSCServerRequest ({
16
31
request ,
17
32
fetchServer ,
Original file line number Diff line number Diff line change @@ -3,15 +3,30 @@ title: createCallServer
3
3
unstable : true
4
4
---
5
5
6
- # createCallServer
6
+ # unstable_createCallServer
7
7
8
8
[ MODES: data]
9
9
10
+ <br />
11
+ <br />
12
+
13
+ <docs-warning >This API is experimental and subject to breaking changes in
14
+ minor/patch releases. Please use with caution and pay ** very** close attention
15
+ to release notes for relevant changes.</docs-warning >
16
+
10
17
## Summary
11
18
12
19
Create a React ` callServer ` implementation for React Router.
13
20
14
21
``` tsx filename=entry.browser.tsx
22
+ import {
23
+ createFromReadableStream ,
24
+ createTemporaryReferenceSet ,
25
+ encodeReply ,
26
+ setServerCallback ,
27
+ } from " @vitejs/plugin-rsc/browser" ;
28
+ import { unstable_createCallServer as createCallServer } from " react-router" ;
29
+
15
30
setServerCallback (
16
31
createCallServer ({
17
32
createFromReadableStream ,
Original file line number Diff line number Diff line change @@ -3,15 +3,30 @@ title: getRSCStream
3
3
unstable : true
4
4
---
5
5
6
- # getRSCStream
6
+ # unstable_getRSCStream
7
7
8
8
[ MODES: data]
9
9
10
+ <br />
11
+ <br />
12
+
13
+ <docs-warning >This API is experimental and subject to breaking changes in
14
+ minor/patch releases. Please use with caution and pay ** very** close attention
15
+ to release notes for relevant changes.</docs-warning >
16
+
10
17
## Summary
11
18
12
19
Get the prerendered RSC stream for hydration. Usually passed directly to your ` react-server-dom-xyz/client ` 's ` createFromReadableStream ` .
13
20
14
- ``` tsx filename=entry.browser.tsx lines=[1]
21
+ ``` tsx filename=entry.browser.ts
22
+ import { startTransition , StrictMode } from " react" ;
23
+ import { hydrateRoot } from " react-dom/client" ;
24
+ import {
25
+ unstable_getRSCStream as getRSCStream ,
26
+ unstable_RSCHydratedRouter as RSCHydratedRouter ,
27
+ } from " react-router" ;
28
+ import type { unstable_RSCPayload as RSCPayload } from " react-router" ;
29
+
15
30
createFromReadableStream (getRSCStream ()).then (
16
31
(payload : RSCServerPayload ) => {
17
32
startTransition (async () => {
Original file line number Diff line number Diff line change @@ -3,15 +3,31 @@ title: matchRSCServerRequest
3
3
unstable : true
4
4
---
5
5
6
- # matchRSCServerRequest
6
+ # unstable_matchRSCServerRequest
7
7
8
8
[ MODES: data]
9
9
10
+ <br />
11
+ <br />
12
+
13
+ <docs-warning >This API is experimental and subject to breaking changes in
14
+ minor/patch releases. Please use with caution and pay ** very** close attention
15
+ to release notes for relevant changes.</docs-warning >
16
+
10
17
## Summary
11
18
12
19
Matches the given routes to a Request and returns a RSC Response encoding an ` RSCPayload ` for consumption by a RSC enabled client router.
13
20
14
21
``` tsx filename=entry.rsc.ts
22
+ import {
23
+ createTemporaryReferenceSet ,
24
+ decodeAction ,
25
+ decodeReply ,
26
+ loadServerAction ,
27
+ renderToReadableStream ,
28
+ } from " @vitejs/plugin-rsc/rsc" ;
29
+ import { unstable_matchRSCServerRequest as matchRSCServerRequest } from " react-router" ;
30
+
15
31
matchRSCServerRequest ({
16
32
createTemporaryReferenceSet ,
17
33
decodeAction ,
Original file line number Diff line number Diff line change @@ -3,15 +3,29 @@ title: routeRSCServerRequest
3
3
unstable : true
4
4
---
5
5
6
- # routeRSCServerRequest
6
+ # unstable_routeRSCServerRequest
7
7
8
8
[ MODES: data]
9
9
10
+ <br />
11
+ <br />
12
+
13
+ <docs-warning >This API is experimental and subject to breaking changes in
14
+ minor/patch releases. Please use with caution and pay ** very** close attention
15
+ to release notes for relevant changes.</docs-warning >
16
+
10
17
## Summary
11
18
12
19
Routes the incoming request to the RSC server and appropriately proxies the server response for data / resource requests, or renders to HTML for a document request.
13
20
14
21
``` tsx filename=entry.ssr.tsx
22
+ import { createFromReadableStream } from " @vitejs/plugin-rsc/ssr" ;
23
+ import * as ReactDomServer from " react-dom/server.edge" ;
24
+ import {
25
+ unstable_RSCStaticRouter as RSCStaticRouter ,
26
+ unstable_routeRSCServerRequest as routeRSCServerRequest ,
27
+ } from " react-router" ;
28
+
15
29
routeRSCServerRequest ({
16
30
request ,
17
31
fetchServer ,
You can’t perform that action at this time.
0 commit comments