Next.js #596
              
                
                  
                  
                    Answered
                  
                  by
                    TatyOko28
                  
              
          
                  
                    
                      houstonTaleubou
                    
                  
                
                  asked this question in
                Q&A
              
            
            
              Next.js
            
            #596
          
          
        -
| What is the difference between Server-Side Rendering (SSR) and Static Site Generation (SSG) in Next.js? | 
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            TatyOko28
          
      
      
        Feb 8, 2025 
      
    
    Replies: 1 comment
-
| Example of SSR (getServerSideProps) in Next.js: export async function getServerSideProps() {
  const res = await fetch('https://api.example.com/data');
  const data = await res.json();
  
  return { props: { data } };
}
export default function Page({ data }) {
  return <div>{JSON.stringify(data)}</div>;
} | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        houstonTaleubou
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Example of SSR (getServerSideProps) in Next.js: