Hacker News new | ask | show | jobs
by paustint 556 days ago
Just use react.... That's what I do - it is so much easier than trying to fight with Next.js.

I have a large application and I use next.js for the landing pages (landing, tos, privacy, blog, login, etc..) - but for the core application after login, I just use vanilla react with react router. For me I keep these as separate applications as I don't want to load the entire app just for the landing page or login box.

Every time I need to work in the nextjs part of the app I always run into problems and have to read the docs and troubleshoot, sift through which part of the docs apply to my setup versus the app router.

If your entire application needs to be indexed as a static site (e.g. content based versus a web application), then vanilla react isn't a good fit - so it depends on your needs.

Unrelated - but shout out to https://nx.dev. I always prefer using this for all of my projects - made it super easy to have my node backend, react frontend, nextjs landing page, chrome extension, cron jobs, etc.. all in the same codebase where I can share code between all of them via non-publishable libraries.

1 comments

Except you can't "just use react". Especially if you have more than one page, or you need to do SSR.
? You can serve a public app that is just static files that uses React in some places. It's no different from using JQuery.
> or you need to do SSR.

This approach doesn't work if you need to SSR any of the content of those components.

This is also a terrible solution UX wise. Your users will see some content and after some time (more or less noticeable, depending on resources, network conditions, etc) the rest of the components start to pop up, cause layout shifts and overal jankiness.

You either use and embrace one of these frontend frameworks or you don't and do progressive enhancement using HotWire, Alpine, Unpoly, Livewire or whatever.

The sprinkling of components is the worst of both worlds.

We may be talking about different things. I don't mean that you literally serve it as a static site, I'm illustrating React is just a view library.

The comment you responded to was about not needing NextJS and you said it's impossible to just use React if you need multiple pages or need SSR.

How so? You can have an MPA with React. If you have a server (Even if it's not NextJS) then you can do SSR. Then you can hydrate with React and manipulate as needed. This is what NextJS does.

I didn't interpret the OP to be saying "You don't need a server."

> Then you can hydrate with React and manipulate as needed. This is what NextJS does.

:facepalm:

Tell me you're a backend developer with little to no experience on this stuff without telling me you're a backend developer.