Skip to content

Commit c9e11b6

Browse files
committed
Added next practise
1 parent ec19d01 commit c9e11b6

File tree

14 files changed

+3672
-0
lines changed

14 files changed

+3672
-0
lines changed

next-practise/.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

next-practise/.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env.local
29+
.env.development.local
30+
.env.test.local
31+
.env.production.local
32+
33+
# vercel
34+
.vercel

next-practise/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
```
12+
13+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
14+
15+
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
16+
17+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
18+
19+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
20+
21+
## Learn More
22+
23+
To learn more about Next.js, take a look at the following resources:
24+
25+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27+
28+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29+
30+
## Deploy on Vercel
31+
32+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33+
34+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

next-practise/next.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
reactStrictMode: true,
3+
}

next-practise/package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "next-practise",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "next dev",
7+
"build": "next build",
8+
"start": "next start",
9+
"lint": "next lint"
10+
},
11+
"dependencies": {
12+
"next": "11.1.2",
13+
"react": "17.0.2",
14+
"react-dom": "17.0.2",
15+
"react-redux": "^7.2.5",
16+
"redux": "^4.1.1"
17+
},
18+
"devDependencies": {
19+
"eslint": "7.32.0",
20+
"eslint-config-next": "11.1.2"
21+
}
22+
}

next-practise/pages/_app.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import "../styles/globals.css";
2+
import reduxWrapper from "../utils/reduxWrapper";
3+
4+
function MyApp(props) {
5+
const { Component, pageProps } = props;
6+
return <Component {...pageProps} />;
7+
}
8+
9+
export default reduxWrapper.wrapper(MyApp);

next-practise/pages/api/hello.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2+
3+
export default function handler(req, res) {
4+
res.status(200).json({ name: 'John Doe' })
5+
}

next-practise/pages/index.js

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import Head from "next/head";
2+
import Image from "next/image";
3+
import { useSelector } from "react-redux";
4+
import styles from "../styles/Home.module.css";
5+
6+
export default function Home(props) {
7+
const count = useSelector((state) => state.counter);
8+
9+
console.log({ count });
10+
11+
return (
12+
<div className={styles.container}>
13+
<Head>
14+
<title>Create Next App</title>
15+
<meta name="description" content="Generated by create next app" />
16+
<link rel="icon" href="/favicon.ico" />
17+
</Head>
18+
19+
<main className={styles.main}>
20+
<h1 className={styles.title}>
21+
Welcome to <a href="https://nextjs.org">Next.js!</a>
22+
</h1>
23+
24+
<p className={styles.description}>
25+
Get started by editing{" "}
26+
<code className={styles.code}>pages/index.js</code>
27+
</p>
28+
29+
<div className={styles.grid}>
30+
<a href="https://nextjs.org/docs" className={styles.card}>
31+
<h2>Documentation &rarr;</h2>
32+
<p>Find in-depth information about Next.js features and API.</p>
33+
</a>
34+
35+
<a href="https://nextjs.org/learn" className={styles.card}>
36+
<h2>Learn &rarr;</h2>
37+
<p>Learn about Next.js in an interactive course with quizzes!</p>
38+
</a>
39+
40+
<a
41+
href="https://github.com/vercel/next.js/tree/master/examples"
42+
className={styles.card}
43+
>
44+
<h2>Examples &rarr;</h2>
45+
<p>Discover and deploy boilerplate example Next.js projects.</p>
46+
</a>
47+
48+
<a
49+
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
50+
className={styles.card}
51+
>
52+
<h2>Deploy &rarr;</h2>
53+
<p>
54+
Instantly deploy your Next.js site to a public URL with Vercel.
55+
</p>
56+
</a>
57+
</div>
58+
</main>
59+
60+
<footer className={styles.footer}>
61+
<a
62+
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
63+
target="_blank"
64+
rel="noopener noreferrer"
65+
>
66+
Powered by{" "}
67+
<span className={styles.logo}>
68+
<Image src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
69+
</span>
70+
</a>
71+
</footer>
72+
</div>
73+
);
74+
}
75+
76+
export function getServerSideProps(ctx) {
77+
return {
78+
props: {},
79+
};
80+
}

next-practise/public/favicon.ico

25.3 KB
Binary file not shown.

next-practise/public/vercel.svg

Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)