Skip to content

Commit 768cfd3

Browse files
authored
test(rsc): test useId (#818)
1 parent 4672651 commit 768cfd3

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

packages/plugin-rsc/examples/basic/src/routes/root.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import { TestTailwind } from './tailwind'
4444
import { TestHmrClientDep2 } from './hmr-client-dep2/client'
4545
import { TestHmrClientDep3 } from './hmr-client-dep3/server'
4646
import { TestChunk2 } from './chunk2/server'
47+
import { TestUseId } from './use-id/server'
4748

4849
export function Root(props: { url: URL }) {
4950
return (
@@ -101,6 +102,7 @@ export function Root(props: { url: URL }) {
101102
<TestTreeShakeServer />
102103
<TestClientChunkServer />
103104
<TestChunk2 />
105+
<TestUseId />
104106
</body>
105107
</html>
106108
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use client'
2+
3+
import { useId } from 'react'
4+
5+
export function TestUseIdClient() {
6+
const id = useId()
7+
return <>test-useId-client: {id}</>
8+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { useId } from 'react'
2+
import { TestUseIdClient } from './client'
3+
4+
export function TestUseId() {
5+
return (
6+
<div data-testid="use-id">
7+
<TestUseIdServer />
8+
|
9+
<TestUseIdClient />
10+
</div>
11+
)
12+
}
13+
14+
function TestUseIdServer() {
15+
const id = useId()
16+
return <>test-useId-server: {id}</>
17+
}

0 commit comments

Comments
 (0)