Answers for "Server-side Rendering in next js"

0

Server-side Rendering in next js

function Page({ data }) {
  // Render data...
}

// This gets called on every request
export async function getServerSideProps() {
  // Fetch data from external API
  const res = await fetch(`https://.../data`)
  const data = await res.json()

  // Pass data to the page via props
  return { props: { data } }
}

export default Page
Posted by: Guest on April-26-2022

Code answers related to "Server-side Rendering in next js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language