next.jsgetstaticprops

getStaticProps runs on every request


when I saw the doccumentation of Nextjs I found out that the difference between getServerSideProps and getStaticProps is that the first runs on every request while the second runs in the background and when using revalidate.

but here I have this code inside my getStaticPros

export async function getStaticProps() { 
console.log("this is my getStaticProps"); 
const response = axios.get("/words/get-all"); 
return { 
    props: { 
     words: response.data, 
    }; 
} 
}

but every time I navigate to /words page I see ""this is my getStaticProps" in the console. what I am missing ?


Solution

  • when I saw the doccumentation of Nextjs

    this is also mentioned in the documentation of Nextjs

    Runs on every request in development : In development (next dev), getStaticProps will be called on every request.