11

I am starting a project where I decided to use Next.js. But my manager doesn't want the app to be in SSR, as it needs a Node server. He wants it to be only SPA.

Now I can use create-react-app and create the app with React, but I was thinking of taking advantage of the Next.js routing and other built-in configs.

As I've seen in Nuxt.js, there is a way of using 'universal' or 'spa' mode, I am searching if there is any way to make 'spa' in Next.js.

2
  • 1
    Your app would still be a SPA but when you deep link the SSR will get you the page faster. Your manager doesn't seem to understand what is what. Commented Sep 22, 2019 at 7:15
  • Actually he knows about it. But he doesn't want SSR. Commented Sep 22, 2019 at 7:24

2 Answers 2

12

Yes it's possible. But that's not what it was built for and you're going to have a hard time keeping it a SPA. The Next routing and other built-in configs are specifically for SSR and creeping towards static site generation. create-react-app and things like React Router were built specifically for SPAs (though they're moving towards better SSR).

So if your boss wants a SPA, use the proper tool for it - today, that's CRA. You'll build it faster and meet the project requirements set forth by your boss. When the boss is ready for a SSR, consider Next. When the boss wants a static site built using React, consider Next or Gatsby.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you. As I didn't get any straightway to do this, I've chosen to go with CRA.
It's 2023, even the official React docs don't support create-react-app anymore. Use Vite instead, that's the modern equivalent of CRA.
0

you can achieve this by using nextjs’s static exports feature

be cautious! some others features are restricted(ssr, rewrite, etc) when using this feature

https://nextjs.org/docs/pages/building-your-application/deploying/static-exports

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.