📜  nextjs getinitialprops 不起作用 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:19.383000             🧑  作者: Mango

代码示例1
//Try not use axios if you're using it.
//if not try use exactly this syntax
export async function getStaticProps() {
  const res = await fetch(`http://localhost:3000/api/blogs`)
  const Blogs = await res.json()
  return {
    props: {
      Blogs,
    },
  }
}