File tree 3 files changed +9
-3
lines changed
3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,9 @@ Create a `<ReactScan>` client component:
26
26
``` jsx
27
27
// path/to/ReactScanComponent
28
28
" use client" ;
29
- import { JSX , useEffect } from " react" ;
29
+ // react-scan must be imported before react
30
30
import { scan } from " react-scan" ;
31
+ import { JSX , useEffect } from " react" ;
31
32
32
33
export function ReactScan (): JSX.Element {
33
34
useEffect (() => {
@@ -43,6 +44,9 @@ export function ReactScan(): JSX.Element {
43
44
Import the ` <ReactScan> ` component into ` app/layout ` :
44
45
45
46
``` jsx
47
+ // app/layout
48
+
49
+ // This component must be the top-most import in this file!
46
50
import { ReactScan } from " path/to/ReactScanComponent" ;
47
51
48
52
// ...
@@ -51,7 +55,7 @@ export default function RootLayout({ children }) {
51
55
return (
52
56
< html lang= " en" >
53
57
< ReactScan / >
54
- < body className = { ` ${ geistSans . variable } ${ geistMono . variable } ` } >
58
+ < body>
55
59
{children}
56
60
< / body>
57
61
< / html>
Original file line number Diff line number Diff line change @@ -30,10 +30,11 @@ export default function Document() {
30
30
Add the following code to your ` App ` component in ` pages/_app ` :
31
31
32
32
``` jsx
33
+ // react-scan must be the top-most import
34
+ import { scan } from " react-scan" ;
33
35
import " @/styles/globals.css" ;
34
36
import type { AppProps } from " next/app" ;
35
37
import { useEffect } from " react" ;
36
- import { scan } from " react-scan" ;
37
38
38
39
export default function App ({ Component, pageProps }: AppProps ) {
39
40
useEffect (() => {
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ Add the following code to your `<RootDocument>` component at `app/routes/__root`
36
36
37
37
``` jsx
38
38
// app/routes/__root.jsx
39
+ // react-scan must be imported before React and TanStack Start
39
40
import { scan } from " react-scan" ;
40
41
import { Meta , Scripts } from " @tanstack/start" ;
41
42
import { useEffect } from " react" ;
You can’t perform that action at this time.
0 commit comments