You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,21 @@ Using the users data from [JSONPlaceholder](https://jsonplaceholder.typicode.com
44
44
45
45
---
46
46
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
+
47
62
## Original README info from create-next-app
48
63
49
64
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).
0 commit comments