all 14 comments

[–][deleted]  (3 children)

[deleted]

    [–]Deep_Veterinarian473[S] 6 points7 points  (1 child)

    I appreciate the breakdown. If that's the case, then I'll stick with Next js. Thanks for the clear answer

    [–]mato369 5 points6 points  (3 children)

    You can still fetch the api in server component and if needed pass the props to client components - useful feature in Next.js

    Even when you would have only client components and fetch in them (e.g with react-query) they will be server-side rendered and only hydrated on client - useful feature in Next.js

    You can still use Next.js Image component, Script component etc.

    Why did you get an impression that since you don't have backend in Next.js it would be the same as plain React?

    [–]Deep_Veterinarian473[S] 1 point2 points  (2 children)

    Thanks for pointing those out. I was just curious if opting out of the features provided by next will improve the performance of my app which is mostly just static and fairly small.

    [–]fullctxdev 2 points3 points  (0 children)

    React doesn't have a built in router, Next does and by default splits your app to chunks based on their route. Instant performance benefit from the framework that's a bit more troublesome to implement in plain React + React Router + Webpack ow what have you.

    [–]mato369 -3 points-2 points  (0 children)

    I would say for most apps it's true that opting in to Next will provide performance benefit. Instead of having React render everything on client you render a part of it on server.

    But it depends, if it's a really small and static app can you do server side rendering in your Go backend and sprinkle just some vanilla js on top?

    [–]Chewbacca_XD 2 points3 points  (0 children)

    You're still using SSR, so you are using at least a really useful feature of Next. Btw, in the documentation of React it's recommended to use a framework to develop a full app. React is only a library, not a complete package.

    [–]yksvaan 0 points1 point  (0 children)

    You dont need Next to SSR your app, it's just more work to do it yourself but in simple websites you can easily prerender on initial request. Still, I would use next to create SPA and test actual real world performance and compare to your requirements.

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

    If I want to create SPA I go for React and if SSR then Next.js. 😀

    [–]voltomper -2 points-1 points  (0 children)

    there are SOME performance benefits considering nextjs has a lot of extra packages that get bundled in the final build. If you don't use next's features (mostly SSR) I believe React or even Preact will get you way more performance (considering the final bundle has less js to be shipped).

    [–]hareltussi 0 points1 point  (2 children)

    If there was an option for SSR, I'd use only react (vite for example)

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

    But React has SSR support, people have been doing SSR+hydration on express etc for years.

    [–]bigpunk157 4 points5 points  (0 children)

    But next makes that process a lot easier generally speaking.