14
kiki
2y

React is just a mediocre ORM for DOM.

Comments
  • 2
    🤔
  • 2
    @jAsE You just did
  • 0
    DOM is not relational 😛
  • 1
    Then you either have not understood react or have not worked with any complex dom operations.

    I have worked with js since netscape 2.0 and react is so far the best linrary to handle it I have seen, vue and angular included.

    And I build my own library before jquery came along.

    And with hooks you do not need any extra state management but we did use MobX on the last job and I liked that, but hooks is very good once you learn how to build them in a good way.
  • 1
    @Voxera I want to hear your thoughts on web components in the modern setting
  • 0
    @Voxera also, about that complex DOM operations. What they are and how react helps with them.
  • 0
    @Lensflare technically it is
  • 0
    @kiki it helps with handling inter component dependencies by managing state and using virtual dom it minimizes the actual dom operation meaning less reflow in the browser and also aggregating changes using document fragments to also minimize redraw operations.

    All this not only makes the components less dependent on each other but saves performance making the site much faster.

    You can if cause do this on your own but then you need to invent your own state management.

    And the document fragments and virtual dom things are seriously complex to handle manually.
  • 0
    @kiki are you referring to react components or some more generalized components?

    If its react components I look at them just as I do for backend components and classes.

    They should be designed for reusability so with specific purposes in separate components if possible.

    And a dingle component should either handle display or business logic/state, preferably not both unless the state is only local state for the visible representation.
  • 0
    @Voxera no, I'm talking about webcomponents, the relatively new spec that includes templates and slots, shadow DOM and scripts type="module". I use them in production now, and I'm getting more and more convinced that "you cannot go fast without virtual DOM" and "virtual DOM is always gonna be faster than altering the DOM manually", phrases I heard a lot when learning React a while ago, were just lies. I'm using React through my whole career, but I was able to achieve better performance by going native. I heard Netflix did the same thing for that exact reason.

    To me, the only complex thing React excels in, with all that boilerplate, virtual DOM and stuff, is lists reconciliation. This in React may be quicker than if you just erase all nodes and inset new ones manually. But I heard there are reconciliators for vanilla JS, and they help to fill that gap.
  • 0
    @kiki Ah, I have not worked enough front end the last 3-4 years to look at them.

    But just from a few seconds of reading I think they either can be a real contender to react or react will start using them under the hood to get even faster ;)
  • 0
    @Voxera that’s the thing. React is resilient to support them, maybe because of some severe architectural fuck-up early on playing with creating things from scratch, and it’s just too late now. React doesn’t support web components as first-class citizens. For it to work, you have to wrap _every_ web component with a react one.

    It’s not “react vs. web components”. The latter is the standard, the native technology. The former is merely a framework, just one among others alike. People sometimes call React “the new jquery”, but I beg to differ. Due to the sheer amount of custom shit like synthetic events, React.Suspense standard that Facebook actively tried to force everyone to comply with and it never happened, oppressive license before they adopted MIT under public pressure and all that stuff, I consider React to be the new Flash.

    …and react-native-web is just laughable. Microsoft Kin shines in comparison.
  • 0
    @kiki I that case if web components offer enough benefits or some other library makes better use they will start nibbling away on react adopters.

    Thats how its been from the start, libraries that fail to adapt gets replaced but not always fast.

    React offers enough benefits that web components does not seem to solve so far so in by them self WC will mot be a replacement.

    And I understand why you cannot use them within react.

    If react if you use a div, your actually not using a div but the react div proxy that will render a div in the end but with a lot more functionality.

    Since react need to have these proxy objects they cannot easily support WC currently.

    But who knows, they might find a way where the developer of WC can create such react wrappers for their WC and that way get it to work.

    But its always been survival of the fittest ;) and react have so far succeeded to stay relevant longer than most other.
  • 0
    @kiki personally I have gone from vanilla js in netscape, through my own library through jquery and then react.

    If WC proves better I will not stay loyal to react :P
  • 0
    @Voxera you might like https://lit.dev. It's Google's take on WC especially for those switching from react. It brings virtual DOM and state management to WC by just adding some neat decorators.

    And it's important to understand that lit is not a framework. It's a small lib on top of WC. WC are the standard now, and you don't need lit to do WC. WC is not going anywhere.
  • 1
    @kiki still, if you already have a few thousand lines of react, switching will be expensive do it will live on for a long time anyway.

    But i love competition, without it development stagnates.
Add Comment