DEV Community

Discussion on: Next.js - the future of React?

Collapse
 
shinabr2 profile image
ShinaBR2

I have worked with NextJS and Redux, Saga, etc for years. And to be honest, the future of React is never be NextJS. It should be Static Site Generator (SSG) like Gatsby instead. I can give you lots of reasone, but the most important thing is: SSG makes frontend developer totally independent to backend/server. Frontend developers nowadays don't just only need good framework, they also need good Development Experience.
Anyway, thanks for your passionate post.

Collapse
 
dotintegral profile image
Artur Siery

A bit on a tangent here - It's funny how the technology comes full circle. Back in a day all we had was static pages (although not generated). Then we had server side pages, finally SPA and now we go back to static pages :-)

Collapse
 
shinabr2 profile image
ShinaBR2

Yes agree :) but frontend development now is very interesting journey. I feel lucky when I have faced the time working with static pages from scratch, only with HTML, JS, CSS till now. That's a long but very fun adventure.

Collapse
 
allangalera profile image
Allan Galera

But nextjs provides SSG capabilities as well. I just think that gatsby locking you to graphql not a good thing :(

Collapse
 
lucianohgo profile image
Luciano H. Gomes

Next.JS doesn't lock you with dynamic rendering and Gatsby doesn't lock you to GraphQL (gatsbyjs.org/docs/using-gatsby-wit...).

SSG is good for 99% of the cases, in some cases you're better off with a dynamic rendering though, i.e. if your data changes a lot above the fold AND you need search indexing on that data frequently. Some notable examples are product catalogs that change a lot, like real estate. Product pages (if you have over 1000000 product pages you won't do them all in build time, some form of dynamic rendering will be needed even if on the spot snapshot rendering + caching for some time). We need to know when to use which.

Thread Thread
 
shinabr2 profile image
ShinaBR2

Yeah correct, but Gatsby team is trying to improve for that case with gatsby cloud.

Thread Thread
 
allangalera profile image
Allan Galera

I mean...that, for me, gatsby is more opinionated than NextJS. I just think it's easier to configure NextJs than to do that with Gatsby. Now (jokes aside) both try to lock you in their cloud service. I find serverless component the best way to do it on AWS for NextJS outsite Vercel service. But that is because I lack a little bit of knowladge to set up that structure for myself :(

Thread Thread
 
shinabr2 profile image
ShinaBR2

I see, everything has its own pros and cons. If you familiar with NextJs, just stick with it as long as it resolves problems :D

Thread Thread
 
allangalera profile image
Allan Galera

At the end we are all stating our opinions :) but it's good to see how others see :) nice talk 🙂

Thread Thread
 
shinabr2 profile image
ShinaBR2

Nice :)

Collapse
 
zilti_500 profile image
Daniel Ziltener

If you use a SSG, you don't need something like React. Because they are complete opposites of each other.

Collapse
 
shinabr2 profile image
ShinaBR2

Yes but SSG I mean, a higher level of frontend development. You can choose whatever you want.

Collapse
 
serializator profile image
Julian

"totally independent to backend/server", could you elaborate on this? Because as I see it with SSR, React would still perform the same requests as with CSR but before sending it to the client?

I'd love to hear! 😉

Collapse
 
shinabr2 profile image
ShinaBR2 • Edited

Sure. NextJS need A WEB SEVER for it, usually Express. But when working with Gatsby, you totally forget about Express or any web server. A real use case is testing frontend on production. With NextJS, you still need to deploy it somewhere to test the production, but with Gatsby, you can totally test production on your server. That sounds like a true "serverless" approach. And Gatsby makes the development experience from development to deployment seamlessly.
Any feedback will be highly appreciated :)

Thread Thread
 
taylorbeeston profile image
Taylor Beeston

Actually, you can use next export and just host your app anywhere that serves static files. See nextjs.org/docs/advanced-features/...

Thread Thread
 
shinabr2 profile image
ShinaBR2

Yes that's the new NextJS feature. But for me, it sounds like they realized that the "static file generator" should be the future, that's why they introduced it.

Thread Thread
 
taylorbeeston profile image
Taylor Beeston

Most of their docs make it seem that way, recommending SSG in most use cases. I just mentioned it because you said that Next forces you to use a backend, but as long as you only use SSG you're good to host your site on e.g. GitHub Pages

Thread Thread
 
shinabr2 profile image
ShinaBR2

Thank you for your reply. That's really a good news for NextJS fan. Let see for a while how both NextJS and SSG grow.

Collapse
 
lucasfrutig0 profile image
lucasfrutig0

obviously scientist