-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
015635c
commit 14b7654
Showing
34 changed files
with
6,698 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
secretfile.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"dashboard": { | ||
"likes": "900K", | ||
"followers": "200k", | ||
"posts": 130 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"posts": [ | ||
{ | ||
"id": 1, | ||
"title": "json-server", | ||
"author": "typicode" | ||
} | ||
], | ||
"comments": [ | ||
{ | ||
"id": 1, | ||
"body": "some comment", | ||
"postId": 1 | ||
} | ||
], | ||
"profile": { | ||
"name": "typicode" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
{ | ||
"products": [ | ||
{ | ||
"id": 1, | ||
"title": "title 1", | ||
"desc": "description 1", | ||
"category": "youth", | ||
"date": "12-03-2013", | ||
"price": 10 | ||
}, | ||
{ | ||
"id": 2, | ||
"title": "title 2", | ||
"desc": "description 1", | ||
"category": "sport", | ||
"date": "12-03-2013", | ||
"price": 20 | ||
}, | ||
{ | ||
"id": 3, | ||
"title": "title 3", | ||
"desc": "description 1", | ||
"category": "sport", | ||
"date": "12-03-2013", | ||
"price": 30 | ||
}, | ||
{ | ||
"id": 4, | ||
"title": "title 4", | ||
"desc": "description 1", | ||
"category": "sport", | ||
"date": "12-03-2013", | ||
"price": 40 | ||
}, | ||
{ | ||
"id": 5, | ||
"title": "title 5", | ||
"desc": "description 1", | ||
"category": "war", | ||
"date": "12-03-2013", | ||
"price": 50 | ||
}, | ||
{ | ||
"id": 6, | ||
"title": "title 6", | ||
"desc": "description 1", | ||
"category": "war", | ||
"date": "12-03-2013", | ||
"price": 60 | ||
}, | ||
{ | ||
"id": 7, | ||
"title": "title 7", | ||
"desc": "description 1", | ||
"category": "war", | ||
"date": "12-03-2013", | ||
"price": 70 | ||
}, | ||
{ | ||
"id": 8, | ||
"title": "title 8", | ||
"desc": "description 1", | ||
"category": "health", | ||
"date": "12-03-2013", | ||
"price": 80 | ||
}, | ||
{ | ||
"id": 9, | ||
"title": "title 9", | ||
"desc": "description 1", | ||
"category": "politic", | ||
"date": "12-03-2013", | ||
"price": 90 | ||
}, | ||
{ | ||
"id": 10, | ||
"title": "title 10", | ||
"desc": "description 1", | ||
"category": "politic", | ||
"date": "12-03-2013", | ||
"price": 100 | ||
} | ||
], | ||
"blogs": [ | ||
{ | ||
"title": "Blog title", | ||
"publish date": "01-01-1970", | ||
"content": "Lorem ipsum dolor sit amet, ", | ||
"category": "beauty" | ||
}, | ||
{ | ||
"title": "Blog title 2", | ||
"publish date": "01-01-1970", | ||
"content": "Lorem ipsum dolor sit amet, ", | ||
"category": "health" | ||
}, | ||
{ | ||
"title": "Blog title 3", | ||
"publish date": "01-01-1970", | ||
"content": "Lorem ipsum dolor sit amet, ", | ||
"category": "beauty" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"products": [ | ||
{ | ||
"id": 1, | ||
"title": "prod 1", | ||
"description": "prod1 desc" | ||
}, | ||
{ | ||
"id": 2, | ||
"title": "prod 2", | ||
"description": "prod2 desc" | ||
}, | ||
{ | ||
"id": 3, | ||
"title": "prod 3", | ||
"description": "prod3 desc" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"paths": { | ||
"@/*": ["./*"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
big issues of SSG: stale data large build time when pages are big , 100000 pages takes an hour to build | ||
|
||
ISR: | ||
updating statically generated pages without rebuilding, with revalidate option | ||
|
||
in getStaticProps() we return revalidate | ||
return { | ||
props: { | ||
data, | ||
}, | ||
revalidate: 10, seconds | ||
}; | ||
|
||
|
||
nextJs serves the client with cache html page | ||
when user send request it responses with the cache | ||
when revalidating after the delay (10 seconds) here the cache will be replaced so , the page still stale until we make another request | ||
|
||
in SSG: | ||
we don't have access to the user request in Real Time | ||
|
||
SSR: pre-rendering | ||
is used only when needed , it's resource consuming and slower than SSG or ISR, (fits in large projects) | ||
SSR is allowed only in a page , not allowed in a component | ||
getServerSideProps should return object containing Props | ||
we can set cookies by accessing the res: we can use them to do operations on token , authentication | ||
|
||
Client Side data fetching: | ||
SEO is Irrelevant | ||
so when building user specific , SEO Irrelevant pages, like profiles, dashboards you better do Client side fetching | ||
SWR is recommended for Client side fetching | ||
|
||
swr auto updates the data fetched when changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
}; | ||
module.exports = nextConfig; |
Oops, something went wrong.