Hacker News new | ask | show | jobs
by lukesan 3792 days ago
What really bothers me about React (and other frameworks) that without JS you do not see anything. No fallback. No progressive enhancement. Is this really the way to go? Did JS replace HTML/CSS as the backbone of websites/applications ?
9 comments

This isn't strictly true. Though the workflow isn't ideal yet, it's perfectly possible to build a React project which is initially rendered on the server and then progressively enhanced. I've done it before, as have others.

In fact, my single biggest criteria for any tech I add to my stack is that it doesn't get in the way of server-side rendering (the second biggest criteria is that it doesn't add significant weight to the client-side JavaScript payload).

Sounds great. Do you know any good resources for building a react application by progressive enhancement?
Google "server side React rendering".
That's not generally true. React is specifically designed to support progressive enhancement. It lets you render your pages on the server, and then the client-side JavaScript will work smoothly with the existing DOM. Redux is a popular state management library for React and it is also specifically engineered to make server rendering painless. All you need to do on the server is load the relevant JSON state for the given URL and give it to React.
There are ways to render the output on the server, which helps search engines, first-page load times and Richard Stallman
+1 for the Stallman pun, so true
I'm with you on this one. Although I use React actively I still have problems with the fact that you won't see content of the app without JS on initial load. Sure, there's a matter of isomorphic applications where React renders content on server during first call, however after trying several times implementing it - just ended up abandoning that idea due to how massively complex various things become in certain cases with authorizations for users and so on.
In the cases where react makes sense - where the users change data together or where new data is often enough generated on the server, yes. Try to make Trello work as well as it does today without javascript - ain't happening, you would be reloading every few seconds in case somebody else has made some changes.

On e.g a newssite react doesn't make much sense though (except, possibly on the backend).

As others have mentioned, you can use the same React code to render on the server. I actually have a blog post about that too: https://camjackson.net/post/server-side-rendering-with-react
And without JS you don't get real applications on the web. Dumb text is fine for web 1.0, 2.0, but modern web applications are expanding far beyond that. Are there ways to be abusive with JS? Sure. But JS is what enables web applications as opposed to just having text-on-page (newspaper 2.0).
This is simply not true. Ignoring the fact that "real application on the web" has no definition... very useful web pages can be created without JavaScript, and they can (quite easily) interact with the user by taking input and updating what they display.

Why is something like that useful? Accessibility, security, backward compatibility, ...

Yes that's why they specifically said web applications not pages. You cannot create web application without JS.
Sure you can. As I explained above.
Honestly, it's 2016. Running a modern web page and browser without javascript is just silly. You're losing out on a lot of quality of life features, that people just expect to be there. It's the equivalent of taking away a touch interface from modern mobile phones.
This is not really relevant to the topic of React. This is like complaining about C not having real booleans when people are trying to discuss clang.