I get the appealing of SSR with frameworks like Next.js (e.g., you get to develop frontend components using React, which is nice). So, my question, for the ones who know, would be: if in the following years a new generic (backend) programming language emerges that allows building frontend components in the backend (think of PHP + Html, but better; or think of Golang templates but better) as easy as it is to build com…
HN doesn't talk about it often but PHP is still the workhorse of the web. And that is for good reason. It's fast, stateless, easy to use and not just batteries included, you also get the charger, the repair kit, repair parts and adapters for seemingly every use case. That said, it's clunky in many ways and (very) slowly losing it's dominance. It's community clings on class based, mutable OO (while even languages like…
Practical Front-End Architecture
111–120 of 164 posts
Re: Practical Front-End Architecture
#112I think the reason we have so many fe/js/options is that no one option has jump out as 'x10 better' than the rest.
Svelte for me at least gets close to 'it' - ymmv
Sidenote(sorry for highjack): The ninja hackers/coders out there please code this next:
Like you know how we have tree shaking for dead js/ts code ?(Really cool and impressive btw)
I want to get "html tree shaking" - Im putting it in quotes since what Im after is:
The least amount and/or optimized html that will generate the same 'view/end-result' of my current unoptimzed html.
Maybe a case for optimal-auto-encoder ?
Re: Practical Front-End Architecture
#113And instead of rendering html or static site generators...we just export everything as one or a few(for responsive) jpeg :) ?
Re: Practical Front-End Architecture
#114> Therefore, we've elected to render our application completely on the client. On Next.js this means that we wrap our React app in a "client-side only" component that looks like this: > > This component only allows our React code to render inside the browser environment, minimizing Next.js' server-side render runtime. Yep, sounds like a practical way to do what is literally the default. So does the 4 paragraphs of cl…
Agreed. Having worked extensively with GraphQL, I’ve come to see it as a MASSIVE source of unnecessary complexity in almost all cases. Haven’t worked with Next.js, but using an SSR framework, then not using SSR, seems like a tonne of unnecessary complexity too. They even say: > At Liferay Cloud, our project lives behind authentication and our clients are enterprise-level, with relatively modern browsers and powerful…
GraphQL is popular because it helps rapidly develop backend services. BE devs don't have to spend as much time wiring up end-points and serializers. But it just shifts the problem from the BE, where it belongs, to the FE where it doesn't. Like you said, it makes FE development needlessly more complicated. Now, instead of focusing on view-related concerns, which is the point of your front-end, devs need to understand more details about the BE's domain model (unnecessarily) and need to use a text-based query language to communicate with the services. It is pure stupidity.
Re: Practical Front-End Architecture
#115I get the appealing of SSR with frameworks like Next.js (e.g., you get to develop frontend components using React, which is nice). So, my question, for the ones who know, would be: if in the following years a new generic (backend) programming language emerges that allows building frontend components in the backend (think of PHP + Html, but better; or think of Golang templates but better) as easy as it is to build com…
The eventual linchpin is roundtrip latency. If you want to have a frontend with native level responsiveness, you simply can not move all logic to the sever. Physics will get in your way. So any universal solution will have to include strong client side prediction in addition to handling the server (something the game industry has understood and implemented for years, and I remain confused as to why it has gained near…
When developing an app recently I added an artificial 1s delay to server responses (during development), but because of optimistic updates you would never notice it was there.
Re: Practical Front-End Architecture
#116Earlier quoted context omitted.
Totally, I think if this article were titled patterns it'd be more accurate. Architecture has a more specific meaning (at least to me). As for using state, when you use something like react-router, all those things, path parameters, query parameters etc are stored in state. You can build hooks that use the hooks provided by react-router to retrieve those values in a useEffect in the relevant components. The hooks you…
I see what you mean. By way of clarification, I see route validation and pageload validation as potentially separate. For example, a given route parameter may govern a whole scope of pages in the app, so it makes sense to centralize that route validation logic rather than duplicate it in each page’s validation hook. In a more traditional server (like Express), we can just handle requests which contain that route para…
I don't know how Next.js' filesystem router works, but it seems to perhaps be the cause for this roundabout solution.
You can do middleware in client side routing with react-router similar to how you would with express. That's exactly what hooks are for and you can build your own to enable that functionality at the scope that's needed.
Re: Practical Front-End Architecture
#117Earlier quoted context omitted.
Not the user you were asking, but the way we do it is that the OpenAPI/Swagger spec is auto-generated from server-side code (a C# .NET app with the ABP framework) during the CI build, and that is then used to auto-generate an API client (via swagger-typescript-api) which is what the frontend app uses. When the backend team makes some changes, they notify the front-end team which then runs the auto-generation script,…
Nice! Why not re-run the auto-generation script automatically?
Re: Practical Front-End Architecture
#118Earlier quoted context omitted.
HN doesn't talk about it often but PHP is still the workhorse of the web. And that is for good reason. It's fast, stateless, easy to use and not just batteries included, you also get the charger, the repair kit, repair parts and adapters for seemingly every use case. That said, it's clunky in many ways and (very) slowly losing it's dominance. It's community clings on class based, mutable OO (while even languages like…
What did Java move to exactly?
Re: Practical Front-End Architecture
#119Earlier quoted context omitted.
I think if we're talking about concepts at the level of OOP, we'd be comparing MVU and virtual DOMs rather than React. I learned to write UIs in F# through Elmish (used by Bolero), which was inspired by (unsurprisingly) Elm. React, also being inspired by Elm, was simple enough to transition to once I was comfortable in Bolero. It was basically MVU with components that have local state and lifetime function callbacks.…
> React, also being inspired by Elm This is news to me, are you sure about that? Wasn't react released earlier than elm?
Re: Practical Front-End Architecture
#120Heaven forbid you’re on a shitty internet connection, these inane js-behemoths just die from a dropped tcp connection, since they’re built on the most optimistic assumptions about network connectivity.
I remember when accessibility was a part of web development, but I guess the ROI was to low.