• ☆ Yσɠƚԋσʂ ☆@lemmy.mlOP
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    2 years ago

    I like the concept of React, but I find it’s much more complex than it needs to be. A lot of the complexity comes from the fact that’s not opinionated enough. For example, React is agnostic regarding what causes a render to happen, so now you have to manage the whole lifecycle as the user and decide whether the component should repaint or not.

    There’s a ClojureScript library called Reagent that uses React internally. However, it made the decision to use reactive atoms as the repainting mechanism. Components observe the state of the atom, and when it changes the component repaints. With this strategy you only have to care about the render portion of the lifecycle. To be fair, React hooks now work similarly to that.

    Another approach I found interesting was HTMX where UI is basically treated as a dumb terminal and all the logic happens server side. I do find there is a lot of value in decoupling business logic from rendering by design.