Skip to content

SPA framework templates #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
marcomuser opened this issue Nov 28, 2024 · 2 comments
Open

SPA framework templates #15

marcomuser opened this issue Nov 28, 2024 · 2 comments

Comments

@marcomuser
Copy link

I think it would be super useful to have an official template starter that bootstraps a simple SPA (in js or ts) in “framework mode” that is easily upgradeable to SSR if desired. Basically a template that bootstraps what is described in this guide: https://reactrouter.com/how-to/spa#single-page-app-spa. This way a new user doesn't have to deal with servers and all that stuff right away, but is already guided on the right path if the use case warrants it (..and I have to say there are more cases than the twitter bubble would have you believe where a SPA is preferred). Isn't that exactly one of the fantastic things about react-router's new version?

Originally posted by @marcomuser in #7 (comment)

@brookslybrand brookslybrand added enhancement New feature or request and removed enhancement New feature or request labels Jan 15, 2025
@cowboy
Copy link

cowboy commented Mar 15, 2025

I came here to file a similar comment. After using Next.js a bunch, I figured I'd check Remix out. I'm dealing with a situation where I can't deploy a server, so I figured I'd give SPA mode a try.

I found https://remix.run/docs/en/main/guides/spa-mode which told me to run npx create-remix@latest --template remix-run/remix/templates/spa but when I did, I got this error: remix-run/remix#10515. Whoops, I completely forgot about React Router v7.

Anyways, then I went over to https://reactrouter.com/how-to/spa but couldn't find any mention of create-react-router, so I did some poking around and found https://reactrouter.com/start/framework/installation. However, when I went looking for a spa template at https://github.com/remix-run/react-router-templates there wasn't one.

I guess I'll try creating a new project using the default template and make the 4 changes listed in the SPA docs at https://reactrouter.com/how-to/spa. Hopefully that will be everything I need to do. But it would be really nice for React Router to have a spa template like Remix did.

@cowboy
Copy link

cowboy commented Mar 15, 2025

Follow-up from 15 minutes in the future:

  1. I ran npx create-react-router@latest
  2. I set ssr: false in react-router.config.ts
  3. It all just works

I should've just done that instead of posting a comment. Although, it just goes to show how simple it would be to create a spa template 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants