일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
- web
- built in object
- middleware
- hardhat
- nextJS
- useState
- API
- Ethereum
- CLASS
- blockchain
- concept
- SSR
- typeScript
- 삶
- HTML
- JavaScript
- REACT
- Interface
- evm
- CSS
- solidity
- Redux
- express.js
- node.js
- Props
- 기준
- tailwindcss
- error
- graphQL
- bitcoin
- Today
- Total
목록getstaticprops (2)
ReasonJun
import Head from 'next/head'; import { Inter } from 'next/font/google'; import Link from 'next/link'; import { useEffect, useState } from 'react'; const inter = Inter({ subsets: ['latin'] }); export async function getStaticProps() { return { props: { time: new Date().toISOString() }, }; } export default function ISR({ time }) { return ( {time} ); } The data is updated when the page is refreshed.
Normally, when importing data in React, import it from useEffect. However, in Nextjs, it is imported using a different method. (Of course, you can also import it using useEffect.) getStaticProps getStaticProps is a Next.js function that allows you to pre-render your pages on the server. This can improve performance and SEO, as the browser does not need to render the pages on its own. The getStat..