Next.js 12 - getStaticProps, getStaticPaths
ยท
♠๏ธ Next.js 12
โœ… getStaticPropsgetServerSideProps๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ์š”์ฒญํ•  ๋•Œ๋งˆ๋‹ค ์‹คํ–‰๋จ.getStaticProps๋Š” ๋นŒ๋“œ์‹œ์— ๋”ฑ ํ•œ ๋ฒˆ๋งŒ ์‹คํ–‰๋˜๊ธฐ ๋•Œ๋ฌธ์— ์ตœ์‹  ๋ฐ์ดํ„ฐ๊ฐ€ ๋ฐ˜์˜์ด ์•ˆ ๋จexport async function getStaticProps() { const blogPosts = readdirSync("./posts").map((file) => { const content = readFileSync(`./posts/${file}`, "utf-8"); const [slug, _] = file.split("."); return { ...matter(content).data, slug }; }); return { props: { posts: blogPosts.r..