19
Cyanide
2y

I officially hate React, now. Hooks are bullshit. useEffect can die in hell.

Comments
  • 3
    What’s wrong with it?
  • 1
  • 4
    Then dont use useEffect. Lol, it may look like a joke but sometimes maybe you just need a smarter solution with clever use of native listeners (onClick)
  • 3
    @kiki web components is not exactly a competitor to react, they do to a degree solve the same problems they have slightly different design philosophies.

    And trying to build in one using the design philosophy of the other is probably always going to be painful.

    Hooks are awesome to solve the state management in react BUT only if you are really building it the react way.

    If you have your own solutions or mix in other frameworks its going to clash.

    Web components as native tooling have the potential to be much better but will require a complete change of how things are designed so if you already have an existing big site based on react switching over is going to be costly.
  • 1
    Web components can't get rid of the shitty imperative DOM model that was so bad from the get go it made string concatenation in jQuery the mainstream way to build UIs parametrically. I'll take native web tech seriously when they support declarative UI.
  • 2
    @lbfalvy web components main feature is encapsulation. How that is implemented could affect if it makes DOM better performing or not, but from the specs, solving the performance was not the goal, the goals was reuse and state isolation, which is good but still puts lots of responsibility on the dev to avoid any unnecessary changes.

    Virtual dom could probably be adapted to handle Web Components.

    Frameworks like React will need more since they work by encapsulating all normal elements in their own components and cannot automatically handle “new unknown elements”.

    Its possible that React adds some way for Web Component developers to create their own wrapper for react to get them to work but I have not heard anything about that.

    React also handles isolation with its wrappers but it also uses virtual DOM to identify what really changed, for example if you rebuild a part of the DOM and the new one is almost identical it will identify the differences and apply only those while you as dev can work as if you rerender everything.

    That makes life a LOT easier for the dev, but without virtual DOM it would wreck havoc on performance since it would trigger massive reflows in the browser.

    So web components really only solves one part of what react helps with, but does that in a standardized way.
  • 1
    @Voxera There's a guide on the React website which explains how to interface with web components, it looked fairly docile.
  • 2
    @lbfalvy ah, I have not seen that I only read about that it was a problem and some of the original descriptions why.

    But thanks, will check it out.
Add Comment