5 ms·
Potentially pretty stupid question, I've never used any React framework like Next.js but I have used React for a while. Are these frameworks always meant to pro
by fabian2k 4y ago
Potentially pretty stupid question, I've never used any React framework like Next.js but I have used React for a while. Are these frameworks always meant to provide the backend as well? I'm using .NET as the backend, so I'm curious if they are something I should look closer at.
I mean for SSR they have to run on the backend, but even that I could imagine running parallel to the main backend. I'm just not sure if you get much benefits out of these frameworks without the tight integration on the backend.
Are next.js and other similar React frameworks worth looking at if you don't use node.js on the backend?
- fulafel 4y agoNo, there are many frontend only frameworks.
- gempir 4y agoYou need some form of backend if you want Server Side Rendering, and SSR is why most people opt-in to a React framework. And then you already have a backend so it's an easy jump to just using Nodejs on your backend as well. But a lot of people also just use NextJS as is and never build any server side code and just run their own API beside it. Or use other frameworks that don't include any SSR features, such as Create-React-App
- EnKopVand 4y ago> Are next.js and other similar React frameworks worth looking at if you don't use node.js on the backend? It depends on why you’re doing so. We’ve recently moved from a C# .net backend to a TypeScript node backend and in such a case it (well obviously) makes perfect sense to utilise next.js. In other cases where you split your front end and backend quite clearly, like using .net APIs and a JS front end it can make sense to use some degree of nextjs if you need to integrate some compiled parts into your react, maybe you need a fast loading and/or front page then it can be valuable to mix it. If you don’t know why you’d need it, you probably don’t, however.
- amcsi 4y agoI've heard people suggest to always use Next.js, because the alternative (Creat-React-App) is being developed too slowly.
- mcintyre1994 4y agoCRA isn’t really an alternative because it doesn’t have a server-side component. It’s also a lot less opinionated around things like routing. I’d say Remix is probably the main competitor to Next, that’s built around React Router and already has support for nested routes/layouts, and has opinionated support for the server-side too.
- amcsi 4y agoI'm implying that if you "don't need Next.js", because it's too heavy-weight (because e.g. you already have a dedicated team working on the back end API using a different language), then too bad: there's no lighter-weight alternative that is viable.
- nsonha 4y agoNextjs has useful defaults and enough basic elements for front-end. create-react-app is just a bunch of oppinions on how to config your app that dont really add much productivity if you are already familiar with webpack. Depending on the need I'd either go with react and my webpack config copied from last project or nextjs. Don't see the point of cra
- AgentME 4y agoNext.js works well in the case you have a separate possibly non-Node backend with a JSON (or otherwise non-HTML) API.
- harg 4y agoThere's nothing stopping you from wiring the Next.js backend up to your databases and external APIs and for simple apps it's likely quite a nice solution. But if your backend consists of complex business logic and needs to talk to lots of different services it can be a lot cleaner to have better distinction between the backend part of your app and the frontend, and just use Next.js' backend for data fetching for the UI. You can also not use Next.js without a Node.js runtime at all and just compile your whole app to static files to be served by a static file server like S3, nginx, etc. The advantage of this over CRA is that you get statically-rendered html (as well as normal client-rendered React interactivity) which is good for SEO and FCP[1] [1]: https://web.dev/fcp/ https://web.dev/fcp/
- smoe 4y agoWe have built our new corporate website with NextJS. After getting some used to the framework's particular opinions about how to do things, it was an overall good experience. The main benefits of such a framework for us in our use case: - 90% of the content is essentially static and can be pre-rendered, the rest is dynamic. With NextJS we can easily mix and match these cases, re-using the same code - We use the backend part to act as a gateway to fetch content from different APIs like the CMS, HR tool, email service, etc. The very little custom backend code required we put into nextjs api functions - It comes with a couple of niceties built-in for page speed like image optimization. - Any frontend dev with some react knowledge can work on it. This is my problem with say WordPress, you fairly quickly hit the point where you need specialized knowledge that you can't re-use that much for other projects in the company. Of course, the same and more can be achieved by selecting libraries to build a bespoke stack, but don't think a fairly standard website that doesn't need to change a whole lot warrants the upfront effort.