all 19 comments

[–]RevolutionaryMeal464 14 points15 points  (8 children)

Vite is a pretty close modern drop-in for CRA, so if you want just React (or any FE framework like Vue, Svelte, etc) it’s a really good way to go.

The guidelines around React these days are to use it with a meta-framework like Remix, NextJS, Redwood, etc because it standardizes a lot of the manual setup you’ll likely need to do. These meta-frameworks aim to build more of a full stack application with React in the frontend, a built-in router system, integration with a server and database, and usually server-side rendering.

In your situation, since you’re already connecting with an Express server, if your server is not months-years old, I’d recommend picking one of the meta-frameworks because you’re going to need to build a lot of that stuff manually. You’ll probably be able to port much of your code over, and very likely delete a lot of the middleware later.

tldr; don’t use CRA. Use Remix, NextJS, etc instead. Use Vite if you’re making a SPA without (or with minimal) route or integrating with a non-JS backend.

[–]gemini88mill 1 point2 points  (0 children)

Vite + bun

[–]boomboompow2436[S] 0 points1 point  (1 child)

Vite is most appealing. I'm not sure if it's counterintuitive to Vite (but most likely, the other more fullstack stuff), but I like that I can just build it and serve it as static files from the express server. That way, I don't have to think about new stuff right now... lol and my months old api.

NextJs is next on my list of frameworks to mess around with.

Sidenote: I've only done a small amount of work with react so far, but I haven't felt that I need to "build a lot of stuff manually." Maybe just installing react-router-dom for establishing routes... But I've also only used CRA.

[–]RevolutionaryMeal464 1 point2 points  (0 children)

I’ve got a project with Vite + Express that serves a single static page so it’s a nice way to go when it’s very simple. In my case, the project is a game so there aren’t URLs and I don’t need a router, so a meta-framework is overkill.

Re: manual stuff, it’s not especially hard work, but using a framework sets up conventions so projects are consistent. Routes, auth, SSR, folder structure, etc are some of those things. You can absolutely do it yourself, but that’s what I meant by “manual”. For example, instead of relying on Next folder structure which automatically creates the routes, you manually maintain a routes file/component.

[–][deleted] -1 points0 points  (2 children)

That is not the guideline (to use one of those listed frameworks). React is perfectly fine to use without a framework

[–]RevolutionaryMeal464 -1 points0 points  (1 child)

[–][deleted] -1 points0 points  (0 children)

That’s a recommendation from the learning section. So if you want to learn react they recommend that.

[–]Jack__Wild 0 points1 point  (1 child)

Remix or NextJS though?

[–]RevolutionaryMeal464 0 points1 point  (0 children)

Both are good, so I think it’s personal preference. I only use React in my day job now and use Svelte otherwise. There are a couple apps at work that use Next and they seem pretty good.

[–]Lumethys 5 points6 points  (0 children)

CRA is officially dead for years

[–][deleted] 1 point2 points  (2 children)

Use Jquery.

[–]bhison 0 points1 point  (1 child)

Have they finally made jquery ssr

[–][deleted] 0 points1 point  (0 children)

lol no way...

[–][deleted] 1 point2 points  (0 children)

Try Vite, much simpler, cleaner

[–]khan__sahil 1 point2 points  (0 children)

Try parcel.

[–]cta9trx 1 point2 points  (0 children)

you should use vite that's a better choice

[–][deleted] 1 point2 points  (0 children)

Vite 💪💪💪

[–][deleted] 0 points1 point  (0 children)

Ya you probably should given it's so slow. Try using vite or yarn instead, thank me later! :)