In this article, we will go through how to create next js as a static site generator by super-simple steps.
Table of Contents
What is Next JS?
“Next is a framework which we can use to build React sites with Server Side Rendering or generate static pages from our react code. All that configured for us by Next itself.”

Let’s create a NEXT.js app to produce static sites.
Type in the following command
npx create-next-app

npm run build

you can try editing your pages and play around with the structure of the next.js app. Let’s try changing the index.js file in the pages folder.
const Home = () => {
return (
<p>
Hello CodeLeaks!
</p>
)
}
export default Home;
npm run dev



When provided with content, the build will be rendered on runtime and through getStaticProps function, we can have the static properties of the page.
export const getStaticProps = () => {
return {
props: {
buildTimestamp: Date.now()
}
}
}


next build && next export
"scripts": {
"build": "next build && next export"
}
Now run the command to export the following site to a static site.
npm run build


Conclusion
You can develop your application in a dynamic way with the entire conventional powerful tool and have your HTML pages generated for you. This is easier and cheaper to host your website with static pages with really fast response as it’s only a bunch of HTML tags.
Learn more about which Hosting is best for static website or application.
https://www.codeleaks.io/static-site-hosting-for-application/