Live data from Hacker News

The React2Shell Story

lachlan.nz

31–40 of 50 posts

Re: The React2Shell Story

#31

Earlier quoted context omitted.

React was ruined from the moment they abandoned class components and introduced hooks. Vercel is just continuing the trend of hype against common sense.

You are probably a Javascript dev, not doing typescript? Classes were horrible to type for, especially when you tried higher-order components. Hooks removed so much clutter and friction and allows pretty well-typed components and higher order functions (i.e. hooks that return components).

Yes, they were uglier but they had advantages that got lost such as an easy to control rendering life cycle.

Just opening dev tools on MIT-written big tech corps and startups confirms nobody is able to write good websites or applications that arent filled with performance and memory leaks.

Re: The React2Shell Story

#32
post #27
post #25

Earlier quoted context omitted.

You can write spaghetti with class components, too. Doesn't sound like a hooks issue to me.

I certainly can, but somehow it cooler to write lambdas upon lambdas, and other Haskellisms when using hooks.

I think we're just gonna agree to disagree. Cheers.

Re: The React2Shell Story

#33

Earlier quoted context omitted.

React was ruined from the moment they abandoned class components and introduced hooks. Vercel is just continuing the trend of hype against common sense.

You are probably a Javascript dev, not doing typescript? Classes were horrible to type for, especially when you tried higher-order components. Hooks removed so much clutter and friction and allows pretty well-typed components and higher order functions (i.e. hooks that return components).

Hooks made simple things simpler, but hard things harder, code with lots of boilerplate was replaced with code with leaky abstractions full of various workarounds - I don't think this is a good trade.

While I hate class component lifecycle methods they are much better than complex hook setups when solving more advanced problems.

Re: The React2Shell Story

#34

Earlier quoted context omitted.

React was ruined from the moment they abandoned class components and introduced hooks. Vercel is just continuing the trend of hype against common sense.

You are probably a Javascript dev, not doing typescript? Classes were horrible to type for, especially when you tried higher-order components. Hooks removed so much clutter and friction and allows pretty well-typed components and higher order functions (i.e. hooks that return components).

I am all around developer, working with typescript from at least 2015.

I’m not exactly sure what complication you mean. Lifecycle method sucks, yeah, but you replaced them with lifecycle hooks. So the same mental overhead but now in a pseudo stateless functions, with state full escape hatches.

Re: The React2Shell Story

#35
post #33

Earlier quoted context omitted.

You are probably a Javascript dev, not doing typescript? Classes were horrible to type for, especially when you tried higher-order components. Hooks removed so much clutter and friction and allows pretty well-typed components and higher order functions (i.e. hooks that return components).

Hooks made simple things simpler, but hard things harder, code with lots of boilerplate was replaced with code with leaky abstractions full of various workarounds - I don't think this is a good trade. While I hate class component lifecycle methods they are much better than complex hook setups when solving more advanced problems.

Just having an interval inside a component used to be trivial, but with hooks becomes tedious. Only the barebones simple ultra basic stuff became simple. Everything else? Harder.

Re: The React2Shell Story

#36
post #13

Earlier quoted context omitted.

React was ruined from the moment they abandoned class components and introduced hooks. Vercel is just continuing the trend of hype against common sense.

I just don't understand this take, every time I hear it I wonder if people just haven't spent the time to adjust their mental model. Hooks are IMO the best thing that happened to react.

I’ve done plenty of hooks. Also class components. Also angular.

You are writing code for an object that is inherently stateful, in a stateless design pattern. Instead of embracing state, you crate escape hatches and plugins to tap into your state, and then more escape hatches inside those escape hatches to tap out.

It’s react rendering model leaking into your code. Let’s imagine react changes the rendering paradigm, and components are rendered once with only state updates. Almost all of your hooks become useless. The fact that you need to think about react internal every time you create a component is such a bad API choice that I’m amazed it still exists, and being expanded.

Re: The React2Shell Story

#37
post #13

Earlier quoted context omitted.

I just don't understand this take, every time I hear it I wonder if people just haven't spent the time to adjust their mental model. Hooks are IMO the best thing that happened to react.

I’ve done plenty of hooks. Also class components. Also angular. You are writing code for an object that is inherently stateful, in a stateless design pattern. Instead of embracing state, you crate escape hatches and plugins to tap into your state, and then more escape hatches inside those escape hatches to tap out. It’s react rendering model leaking into your code. Let’s imagine react changes the rendering paradigm,…

So your argument is that instead of explicit class component methods, hooks are implicit based on understanding the react rendering model?

I guess so - but react could also change (and I think did at some point) how their class methods work, how often they're triggered, and when.

I don't understand the stateless comment - hooks are as stateful as you make them, using useState or useContext or any of the other ways of maintaining data between renders.

Re: The React2Shell Story

#38
post #25
post #18

Earlier quoted context omitted.

I have spent more time than I wished for on React debugging tools, and useXXXX spaghetti calls.

You can write spaghetti with class components, too. Doesn't sound like a hooks issue to me.

Of course, the only question is in what way the programming language pushes you. You can TS code where every variable is assigned “any” type, that would void all type safety. Is it possible? Yes. But someone needs to bend the languages will to do that.

Classes have inherent state, and methods which encapsulate logic. That pushed you to create separate logic bundles.

Functions are callable scripts. There are no rules. I’ve seen too many components that invoke tens of hooks, and hundreds of lines of state management. Most classes I’ve seen never reached that. Were there classes that were too big? Of course, but at least there was logic separation with methods.

Re: The React2Shell Story

#39
post #37

Earlier quoted context omitted.

I’ve done plenty of hooks. Also class components. Also angular. You are writing code for an object that is inherently stateful, in a stateless design pattern. Instead of embracing state, you crate escape hatches and plugins to tap into your state, and then more escape hatches inside those escape hatches to tap out. It’s react rendering model leaking into your code. Let’s imagine react changes the rendering paradigm,…

So your argument is that instead of explicit class component methods, hooks are implicit based on understanding the react rendering model? I guess so - but react could also change (and I think did at some point) how their class methods work, how often they're triggered, and when. I don't understand the stateless comment - hooks are as stateful as you make them, using useState or useContext or any of the other ways of…

Classes are inherently stateful. A class instance is a long lived object. Functions are not, a functions internal state is thrown the moment the function returns. What react ask you to do is to attach to external state inside the function, in other words, an un pure function, forego idempotency.

In class based components, you didn’t care how react works under the hood, except for the render method which is called by react. So the surface of code controlled by react was only what you included inside that method. In function components, the entire function is owned by the renderer, so you need to deeply understand how it works.

Re: The React2Shell Story

#40
post #25

Earlier quoted context omitted.

You can write spaghetti with class components, too. Doesn't sound like a hooks issue to me.

Of course, the only question is in what way the programming language pushes you. You can TS code where every variable is assigned “any” type, that would void all type safety. Is it possible? Yes. But someone needs to bend the languages will to do that. Classes have inherent state, and methods which encapsulate logic. That pushed you to create separate logic bundles. Functions are callable scripts. There are no rules.…

The great sin of the migration to hooks was that the docs were so poorly written that everyone got into bad habits.

You can have self documenting state like class components in the form of reducers which are just state machines. But it is much later in the documentation.

Post reply on HN