Skip to content

Commit 9bc1579

Browse files
author
justintsugranes
committed
syncing all local edits
1 parent e10d24d commit 9bc1579

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

.eslintrc.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"extends": "next/core-web-vitals"
2+
"extends": ["next/core-web-vitals"],
3+
"rules": {
4+
"react/no-unescaped-entities": "off",
5+
"@next/next/no-page-custom-font": "off"
6+
}
37
}

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,21 @@ Using the users data from [JSONPlaceholder](https://jsonplaceholder.typicode.com
4444

4545
---
4646

47+
### getStaticProps
48+
49+
1. getStaticProps runs only on the server side
50+
1. the fucntion will never fun client-side
51+
2. the code you write inside getStaticProp won't even be included in the JS bundle that is sent to the browser
52+
2. You can write server-side code directly in getSaticProps
53+
1. Accessing the file system using the fs moduleor querying a database can be done inside getStaticProps
54+
3. getStaticProps is allowed only in page and cannot be run from a regular component file
55+
1. It is used only for pre-rendering and not client-side data fetching
56+
4. getStaticProps should return an object and object should contain a props key which is an object
57+
5. getStaticProps will run at build time
58+
1. During development, getStaticProps runs on every request
59+
60+
---
61+
4762
## Original README info from create-next-app
4863

4964
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).

pages/users.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function UserList({ users }) {
66
return (
77
<div key={user.id}>
88
<p>{user.name}</p>
9-
<Uer user={user} />
9+
<User user={user} />
1010
</div>
1111
)
1212
})}

0 commit comments

Comments
 (0)