Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Server renders the page. Suppose you have a element there which reads like <div data-component="HenloComponent">...</div>. Then the .js framework which was loaded on that page queries the DOM in search of any elements with data-component attribute and creates instances of HenloComponent (which is a class written by you, the developer, user of the framework). It's a bit more complicated than that, but that's the essence of it.

Note that with this approach you don't need to "render" anything, browser already done it for you. You merely attaching functionality to DOM elements in the form of Component instances.





Yes, that is what I was asking about.

I entirely agree. It is what I do when I have to - although I mostly do simple JS as I am a backend developer really, and if I do any front end its "HTML plus a bit of JS" and I just write JS loading stuff into divs by ID.

When i have worked with front end developers doing stuff in react it has been a horrible experience. In the very worst case they used next.js to write a second backend that sat between my existing Django backend (which had been done earlier) and the front end. Great for latency! It was an extreme example but it really soured my attitude to complex front ends. The project died.


> In the very worst case they used next.js to write a second backend that sat between my existing Django backend (which had been done earlier) and the front end.

That's hilarious.

Casey Muratori truly is right when he says to "non-pessimize" software (= make it do what it should do and not more), before optimizing it.


Oh no, they do that? I thought Next.js is a fully functional backend itself, like Django. But I'm shocked to learn that it's just a middleman-backend to render templates that are already served from another backend.

Next.js is a a fully functional backend. Its not Next's fault - I dislike it for other reasons, but this was not a Next problem.

The problem was that the front end developers involved decided to use Next.js to replace the front end of a mostly complete Django site. I think it was very much a case of someone just wanting to use what they knew regardless of whether it was a good fit - the "when all you have is a hammer, everything looks like a nail" effect.


It is Vercel's "fault" because it sold Next.JS as a BFF (Backend-for-frontend), a concept that didn't exist but helped them sell lots of hosting for React, something absolutely unexpected to every old school React developer.

I did not know they sold it as that.

I did a search and a lot of people are promoting the concept. Maybe it makes sense if you have a strong reason to use micro services, but for the vast majority of systems it seems crazy!




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: