@@ -25,10 +25,10 @@ Logs out based on fetch responses. By default this is triggered by [401 (Unautho
25
25
defaultValue="18-web"
26
26
groupId="platform"
27
27
values={[
28
- { label: 'React Web 16+', value: 'web' },
29
28
{ label: 'React Web 18+', value: '18-web' },
30
29
{ label: 'React Native', value: 'native' },
31
30
{ label: 'NextJS', value: 'nextjs' },
31
+ { label: 'React Web 16+', value: 'web' },
32
32
] }>
33
33
<TabItem value =" web " >
34
34
@@ -88,20 +88,32 @@ AppRegistry.registerComponent('MyApp', () => Root);
88
88
89
89
<TabItem value =" nextjs " >
90
90
91
- ``` tsx title="pages/_app.tsx"
92
- import { DataProvider , LogoutManager , getDefaultManagers } from ' @data-client/react' ;
93
- import { AppDataProvider } from ' @data-client/ssr/nextjs' ;
94
- import type { AppProps } from ' next/app' ;
91
+ ``` tsx title="app/_layout.tsx"
92
+ import Provider from ' ./Provider' ;
93
+
94
+ export default function RootLayout({ children }) {
95
+ return (
96
+ <html >
97
+ <body >
98
+ <Provider >
99
+ { children }
100
+ </Provider >
101
+ </body >
102
+ </html >
103
+ );
104
+ }
105
+ ```
106
+
107
+ ``` tsx title="app/Provider.tsx"
108
+ ' use client' ;
109
+ import { LogoutManager , getDefaultManagers } from ' @data-client/react' ;
110
+ import { DataProvider } from ' @data-client/react/nextjs' ;
95
111
96
112
// highlight-next-line
97
113
const managers = [new LogoutManager (), ... getDefaultManagers ()];
98
114
99
- export default function App({ Component , pageProps }: AppProps ) {
100
- return (
101
- <AppDataProvider managers = { managers } >
102
- <Component { ... pageProps } />
103
- </AppDataProvider >
104
- );
115
+ export default function Provider({ children }: { children: React .ReactNode }) {
116
+ return <DataProvider managers = { managers } >{ children } </DataProvider >;
105
117
}
106
118
```
107
119
0 commit comments