Skip to content

Commit d7194ee

Browse files
committed
fix: mention React.use SSR bug workaround
1 parent fa1d260 commit d7194ee

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/plugin-rsc/examples/starter/src/client.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,11 @@ export function ClientCounter() {
1111
</button>
1212
)
1313
}
14+
15+
const promise = Promise.resolve('ok')
16+
17+
export function TestClientUse() {
18+
const value = React.use(promise)
19+
console.log(value)
20+
return <span>TestClientUse: {value}</span>
21+
}

packages/plugin-rsc/examples/starter/src/root.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import './index.css' // css import is automatically injected in exported server
22
import viteLogo from '/vite.svg'
33
import { getServerCounter, updateServerCounter } from './action.tsx'
44
import reactLogo from './assets/react.svg'
5-
import { ClientCounter } from './client.tsx'
5+
import { ClientCounter, TestClientUse } from './client.tsx'
66

77
export function Root() {
88
return (
@@ -14,7 +14,8 @@ export function Root() {
1414
<title>Vite + RSC</title>
1515
</head>
1616
<body>
17-
<App />
17+
<TestClientUse />
18+
{/* <App /> */}
1819
</body>
1920
</html>
2021
)

0 commit comments

Comments
 (0)