-
-
Notifications
You must be signed in to change notification settings - Fork 241
Expand file tree
/
Copy pathroot.tsx
More file actions
60 lines (56 loc) · 1.52 KB
/
root.tsx
File metadata and controls
60 lines (56 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import './index.css'
import viteLogo from '/vite.svg'
import { getServerCounter, updateServerCounter } from './action.tsx'
import reactLogo from './assets/react.svg'
import { ClientCounter } from './client.tsx'
import { TestUseActionState } from './action-from-client/client.tsx'
import { TestActionBind } from './action-bind/server.tsx'
// using the client component directly works
import { NextRouter } from '@storybook/nextjs-vite-rsc/rsc/client'
import Link from 'next/link'
export function Root() {
return (
<NextRouter url="/some-path-name">
<App />
</NextRouter>
)
}
export function WorkingRoot() {
return (
<NextRouter url="/some-path-name">
<App />
</NextRouter>
)
}
function App() {
return (
<div id="root">
<div>
<Link href="https://vite.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</Link>
<a
href="https://react.dev/reference/rsc/server-components"
target="_blank"
>
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + RSC</h1>
<div className="card">
<ClientCounter />
</div>
<div className="card">
<form action={updateServerCounter.bind(null, 1)}>
<button>Server Counter: {getServerCounter()}</button>
</form>
</div>
<div className="card">
<TestUseActionState />
</div>
<div className="card">
<TestActionBind />
</div>
</div>
)
}