Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/framework/react/start/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,12 @@ import { createRouter } from './router'

const router = createRouter()

hydrateRoot(document.getElementById('root')!, <StartClient router={router} />)
const root = document.getElementById('root')
if (!root) {
throw new Error('Root element not found')
}

hydrateRoot(root, <StartClient router={router} />)
```

This enables us to kick off client-side routing once the user's initial server request has fulfilled.
Expand Down Expand Up @@ -241,7 +246,7 @@ Now that we have the basic templating setup, we can write our first route. This

```tsx
// app/routes/index.tsx
import * as fs from 'fs'
import * as fs from 'node:fs'
Comment thread
SeanCassiere marked this conversation as resolved.
import { createFileRoute, useRouter } from '@tanstack/react-router'
import { createServerFn } from '@tanstack/start'

Expand Down Expand Up @@ -273,6 +278,7 @@ function Home() {

return (
<button
type="button"
onClick={() => {
updateCount(1).then(() => {
router.invalidate()
Expand Down