DEV Community

Cover image for Next Js SSR [getServerSideProps]

Posted on

Next Js SSR [getServerSideProps]

How Ssr code will work in Next js

  • If a page uses Server-side Rendering, the page HTML is generated on each request.

  • Server-side Rendering: The HTML is generated on each request. To make a page use Server-side Rendering, export getServerSideProps. Because Server-side Rendering results in slower performance than Static Generation, use this only if absolutely necessary.

const App = ({data}) => {
return (
    //jsx  will go here // render the data

export async function getServerSideProps() {
//fetching data from some api
const res  = fetch('')
const data = await res.json()

return {

export default App;

Enter fullscreen mode Exit fullscreen mode

Top comments (0)