How to Create a Single Page App with NextJs
NextJs is very useful for creating static websites but how do you configure it if you are building a single page application (SPA)? The setup isn’t immediately obvious.
The key thing here is we don’t want to build a page on the server when the path is dynamic.
Let’s take a look at how you can set it up, it’s actually pretty straight-forward.
Rewrites
The first piece of this puzzle is the rewrites function within next.config.js.
Dave Taylor - Software Engineer