Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate the with-jotai example from page router to app router #63390

Merged
merged 6 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions examples/with-jotai/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Provider } from "jotai";
import { Metadata } from "next";

export const metadata: Metadata = {
icons: "/favicon.ico",
};

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>
<Provider>{children}</Provider>
</body>
</html>
);
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import Head from "next/head";
import Image from "next/image";
import styles from "../styles/Home.module.css";
import "../styles/globals.css";
import Canvas from "../components/Canvas";
import { Metadata } from "next";

export const metadata: Metadata = {
title: "with-jotai",
description: "Generated by create next app",
};

export default function Home() {
return (
<div className={styles.container}>
<Head>
<title>with-jotai</title>
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
</Head>
<h1 className={styles.title}>With Jotai example</h1>
<main className={styles.main}>
<Canvas />
Expand Down
2 changes: 2 additions & 0 deletions examples/with-jotai/components/Canvas.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import { atom, useAtom } from "jotai";

type Point = [number, number];
Expand Down
3 changes: 2 additions & 1 deletion examples/with-jotai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"start": "next start"
},
"dependencies": {
"jotai": "1.7.3",
"jotai": "2.7.1",
"next": "latest",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/node": "20.11.28",
"@types/react": "17.0.16",
"eslint": "7.32.0",
"eslint-config-next": "11.0.1",
Expand Down
11 changes: 0 additions & 11 deletions examples/with-jotai/pages/_app.tsx

This file was deleted.

13 changes: 0 additions & 13 deletions examples/with-jotai/pages/api/hello.ts

This file was deleted.

12 changes: 9 additions & 3 deletions examples/with-jotai/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
"jsx": "preserve",
"plugins": [
{
"name": "next"
}
],
"strictNullChecks": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}