Open MinJeung-Kim opened 1 year ago
revalidate
fetch
const res = await fetch("https://meowfacts.herokuapp.com"); const data = await res.json(); const factText = data.data[0];
$ npm run build && npm run start
const res = await fetch("https://meowfacts.herokuapp.com", { cache:'reload', }); const data = await res.json(); const factText = data.data[0];
cache:'no-store'
const res = await fetch("https://meowfacts.herokuapp.com", { cache:'no-store', next: { revalidate: 0 }, }); const data = await res.json(); const factText = data.data[0];
๐๏ธ Server Component
๐๏ธfetch๋ฅผ ์ฌ์ฉํ SSG ๋ ๋๋ง
revalidate
๋ฅผ ํด์ฃผ์ง ์์ผ๋ฉดfetch
๋ ์๋ฒ๊ฐ ๋น๋๋ ๋ ๋ฑ ํ๋ฒ๋ง ๋คํธ์ํฌ ํต์ ์ด ์ผ์ด๋จ.๐fetch๋ฅผ ์ฌ์ฉํ ISR ๋ ๋๋ง
๐คfetch๋ฅผ ์ฌ์ฉํ SSR ๋ ๋๋ง
cache:'no-store'
๋ฅผ ํ๋ฉด ์บ์๋ฅผ ํด๋์ง ์๊ธฐ๋๋ฌธ์ ์์ฒญ์ ํ ๋๋ง๋ค ํ์ด์ง ๋ ๋๋ง์ด ๋จ.