Skip to content

Commit f6ef016

Browse files
authored
fixup: consistent code formatting
1 parent 5c48c7c commit f6ef016

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

docs/guides/ssr.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ Fetch your initial data in a Server Component higher up in the component tree, a
5555

5656
```tsx
5757
// app/page.jsx
58-
export default async function RootPage() {
58+
export default async function Home() {
5959
const initialData = await getPosts()
6060

6161
return <Posts posts={initialData} />
6262
}
6363
```
6464

6565
```tsx
66-
// app/Posts.jsx
66+
// app/posts.jsx
6767
'use client'
6868

6969
import { useQuery } from '@tanstack/react-query'
@@ -82,26 +82,25 @@ export function Posts(props) {
8282
The hooks provided by the `react-query` package need to retrieve a `QueryClient` from their context. Wrap your component tree with `<QueryClientProvider>` and pass it an instance of `QueryClient`.
8383

8484
```tsx
85-
// app/Providers.jsx
85+
// app/providers.jsx
8686
'use client'
8787

88-
import { useState } from 'react'
8988
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
9089

91-
export function Providers({children}) {
92-
const [queryClient] = useState(new QueryClient())
90+
export default function Providers({children}) {
91+
const [queryClient] = React.useState(() => new QueryClient())
9392

9493
return (
9594
<QueryClientProvider client={queryClient}>
9695
{children}
9796
</QueryClientProvider>
98-
);
97+
)
9998
}
10099
```
101100

102101
```tsx
103102
// app/layout.jsx
104-
import { Providers } from './Providers'
103+
import Providers from './providers'
105104

106105
export default function RootLayout({children}) {
107106
return (
@@ -111,7 +110,7 @@ export default function RootLayout({children}) {
111110
<Providers>{children}</Providers>
112111
</body>
113112
</html>
114-
);
113+
)
115114
}
116115
```
117116

0 commit comments

Comments
 (0)