You might be, I am not! All my react apps for work in the last ten years I’ve spent little time doing this. The occasional useMemo and relatively intelligent splitting of components is all you need. I don’t even know what “hydration boundaries” are; sounds more like a next.js thing than a react thing. Why is everyone pulling in frameworks that do a bunch of SSR nonsense for B2B apps I just don’t know - but that’s a conscious choice and is not fundamental to react itself.
React is winning by default and slowing innovation
501–510 of 866 posts
Re: React is winning by default and slowing innovation
#502React isn't winning by default. It's been so effective, so well designed that it's lived long enough to become the defacto standard... and the villian. Claiming React is slowing innovation is an absolutely bonkers take when React is essentially the only sane stable choice in a sea of "me too" frameworks and libraries with conflicting and confusing design choices.
It started simple and sound idea but had its quirkiness with shouldUpdate, didReceive, willUnmount. But that wasn't enough, to write decent applications, you need to do unidirectional flow. You can do that, all you need is actions, action creators and dispatchers! Now you have all this bloat that eventually leads to reflux. While you're tearing your head screaming "What the flux", redux comes along and says hey you know what, if you just write a giant switch statement, you don't need dispatchers. And everybody liked not having to read about dispatchers, so redux was here to say. If it gave more problems you can just create a toolkit around it. Besides, it claimed to be functional. Surely that means it works, right? Now you could rub shoulders with those cool clojure kids who seem to be getting all those high paying jobs. But the cool clojure kids are not impressed. They say, class is something you are, not something you write. So you hang your head in shame and promise to never write classes again. While you're untangling yourself from this mixin mess you got mixed up with, an epiphany hits you. If you can emulate a class using functions, then you don't have to write classes again! And so you finally get around to ridding yourself of classes. Sure it means you have to write more functions, and nested functions and wrap all your functions and shove the state away somewhere you can't see, but it makes everything functional, which means it works. Except for handling exceptions globally, you'll need to use classes for that. And by the way, don't worry about unidirectionality. Everything is asynchronous now.
Re: React is winning by default and slowing innovation
#503Earlier quoted context omitted.
I humbly disagree. I've never built a highly interactive application with React, only simple sites where the guys before me chose React, so I can't speak to its relative strengths or weaknesses there, but I've found that it doesn't scale down very well to simple sites. For a simple sign-in page, it's easy to just store state in the DOM and use a element to send the credentials, and maybe a little JS for the password…
Netflix didn't move away from react. They render landing pages with static react components through server-side rendering and only add the minimal interactivity on top through client side js to avoid shipping all of react's state management etc. to the client.
Re: React is winning by default and slowing innovation
#504React isn’t just "winning by default" It's winning because at the core it's just JavaScript function composition. A component is a function, conditionals are `if (...) { ... } else { ... }`, loops are `map()`. JSX is just sugar for function calls. In Svelte you are writing XML with little JavaScript islands inside it. Instead of if you get `{#if}{:else}{/if}`. Thats not "ergonomic" – thats a mini-language stapled on…
So JSX is pure Javascript and not, say, a dialect of XML embedded in JS? Because it sure looks like the former even though it compiles to the latter. React isn't Javascript. It's a franken-language that looks superficially like a mix of JavaScript and XML whilst following the rules of neither. That's why there is such a thing as a React compiler - a good sign that you're not writing JS, which doesn't have compilers.…
It would be best to think of it as syntax sugar for create Element() function calls. You enter JSX with angle tags and insert expressions in braces
> React is full of magic syntax that looks like functions, but e.g. you can't call them inside an if statement, or you have to redundantly declare the 'dependencies' (variables you read) and so on
That's not magic syntax. That's just functions that must be processed in regular order between render ticks.
It's not a difficult exercise to write a "plain JS" function that works that way. If you've worked much with closures you can visualise how that would play out.
Re: React is winning by default and slowing innovation
#505There are certainly good reasons to be concerned about a front end monoculture, and what follows is a curious observation rather than an attempt to discount the points being made here. Ten years ago, we had the opposite of a monoculture. We had new frameworks hitting the front pages of HN every week. We had the shitshow that was Angular 1.x -> 2.0. We had people inventing terms like JavaScript fatigue to express the…
Re: React is winning by default and slowing innovation
#506Over 10 years writting front ends. I hate react, but this article is junk, it advocates for new "reacts". This exact mentality is what got us the bad parts of React, and it's going to give us the bad parts of whatever next library. All the problems that react faces had already been solved by another framework, YEARS in advance. That framework is ember.js. And you know why? Because react started out as an view layer l…
Re: React is winning by default and slowing innovation
#507React isn’t just "winning by default" It's winning because at the core it's just JavaScript function composition. A component is a function, conditionals are `if (...) { ... } else { ... }`, loops are `map()`. JSX is just sugar for function calls. In Svelte you are writing XML with little JavaScript islands inside it. Instead of if you get `{#if}{:else}{/if}`. Thats not "ergonomic" – thats a mini-language stapled on…
So JSX is pure Javascript and not, say, a dialect of XML embedded in JS? Because it sure looks like the former even though it compiles to the latter. React isn't Javascript. It's a franken-language that looks superficially like a mix of JavaScript and XML whilst following the rules of neither. That's why there is such a thing as a React compiler - a good sign that you're not writing JS, which doesn't have compilers.…
You say that like it's a bad thing - but it didn't stop Babel or TypeScript from being popular, both of which need a compiler. And being honest, I don't like extra tools in my chain, which is probably why I don't use React proper, but that proves you don't need anything React specific for anything other than optimisation
The only syntax you really want for React is JSX. Which is just because writing React.createElement("div" ...) every time is unergomomic. JSX isn't specific to React. It could easily be a language feature, in fact it is an OOTB language feature of TypeScript.
> React is full of magic syntax that looks like functions, but e.g. you can't call them inside an if statement
They look like function calls, because they are. They're not "magic syntax", and in fact, those rules are explicitly because theres no way around that without implementing special syntax
Re: React is winning by default and slowing innovation
#508Earlier quoted context omitted.
Strong disagree. Web Components are react in different clothing. You don’t need this component-based framework style architecture to write applications for the browser. I promise writing applications for the browsers is not challenging. You don’t need big frameworks or component madness that’s more of the same.
Sure you can make a blog without a framework. But for complex applications it’s far better/easier than raw DOM manipulation or rolling your own thing.
Re: React is winning by default and slowing innovation
#509Re: React is winning by default and slowing innovation
#510React isn't winning by default. It's been so effective, so well designed that it's lived long enough to become the defacto standard... and the villian. Claiming React is slowing innovation is an absolutely bonkers take when React is essentially the only sane stable choice in a sea of "me too" frameworks and libraries with conflicting and confusing design choices.
In what way React is anywhere near well designed? Look over quick starts of React and Angular, for example. One is a well structured application , the other is a spaghetti script , all held by magic and conventions. If you recall the (in)famous "PHP: a fractal of bad design", React basically ticks every box in this rant and then some. It's not surprise knowing it's origins, but still. The reasons React has got tracti…
React: Where is the code for the component that is used here? Either defined in the same file or imported, like any other javascript thing.
But React is the crazy one.