This commit is contained in:
5
examples/next-with-approuter/next-env.d.ts
vendored
Normal file
5
examples/next-with-approuter/next-env.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||
6
examples/next-with-approuter/next.config.js
Normal file
6
examples/next-with-approuter/next.config.js
Normal file
@@ -0,0 +1,6 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
experimental: {},
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
||||
21
examples/next-with-approuter/package.json
Normal file
21
examples/next-with-approuter/package.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "next-with-approuter",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 4000",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "20.5.7",
|
||||
"@types/react": "18.2.21",
|
||||
"@types/react-dom": "18.2.7",
|
||||
"next": "13.4.19",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"typescript": "5.2.2",
|
||||
"@aptabase/react": "*"
|
||||
}
|
||||
}
|
||||
27
examples/next-with-approuter/src/app/Counter.tsx
Normal file
27
examples/next-with-approuter/src/app/Counter.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
'use client';
|
||||
|
||||
import { useAptabase } from '@aptabase/react';
|
||||
import { useState } from 'react';
|
||||
|
||||
export function Counter() {
|
||||
const { trackEvent } = useAptabase();
|
||||
const [count, setCount] = useState(0);
|
||||
|
||||
function increment() {
|
||||
setCount((c) => c + 1);
|
||||
trackEvent('increment');
|
||||
}
|
||||
|
||||
function decrement() {
|
||||
setCount((c) => c - 1);
|
||||
trackEvent('decrement');
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<p>Count: {count}</p>
|
||||
<button onClick={increment}>Increment</button>
|
||||
<button onClick={decrement}>Decrement</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
11
examples/next-with-approuter/src/app/layout.tsx
Normal file
11
examples/next-with-approuter/src/app/layout.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { AptabaseProvider } from '@aptabase/react';
|
||||
|
||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>
|
||||
<AptabaseProvider appKey="A-US-5431775171">{children}</AptabaseProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
9
examples/next-with-approuter/src/app/page.tsx
Normal file
9
examples/next-with-approuter/src/app/page.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Counter } from './Counter';
|
||||
|
||||
export default async function Home() {
|
||||
return (
|
||||
<main>
|
||||
Aptabase + Next.js App Router <br /> <Counter />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
27
examples/next-with-approuter/tsconfig.json
Normal file
27
examples/next-with-approuter/tsconfig.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user