Skip to content

Commit

Permalink
Merge pull request #78 from ethanniser/conditional-load-react-scan
Browse files Browse the repository at this point in the history
conditional load react scan
  • Loading branch information
RhysSullivan authored Dec 2, 2024
2 parents 0d170fd + 03072db commit 8fc0c11
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 6 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"openai": "^4.68.0",
"react": "19.0.0-rc-cd22717c-20241013",
"react-dom": "19.0.0-rc-cd22717c-20241013",
"react-scan": "^0.0.35",
"slugify": "^1.6.6",
"sonner": "^1.5.0",
"tailwind-merge": "^2.5.4",
Expand Down
87 changes: 81 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions src/app/scan/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"use client";

import { scan } from "react-scan"; // import this BEFORE react
import React from "react";
import Link from "next/link";

if (typeof window !== "undefined") {
scan({
enabled: true,
});
}

export default function ScanPage() {
return (
<div className="flex h-screen flex-col items-center justify-center">
<p className="mb-4 text-lg">
React Scan has loaded, you can now start exploring the site
</p>
<Link href="/" className="text-blue-500 underline hover:text-blue-700">
Back to home
</Link>
</div>
);
}

0 comments on commit 8fc0c11

Please sign in to comment.