1. 23
  1. 7

    I share some of the author’s skepticism about React’s Concurrent Mode.

    I have personally shipped schedulers for complex, interactive JavaScript apps. I think it’s a useful technique, but it’s going to be extremely difficult to build something that doesn’t have easily accessible terrifying edge cases.

    I think a relevant piece of precedent is the introduction of Hooks to React. Hooks are a completely unsound abstraction that will break if the order of your hook calls change. To mitigate this, the React team recommends using a lint rule that prevents hook calls in asynchronous code or closures, among other places.

    However, this lint rule itself still has edgecases, most notably around module boundaries.

    In the past, it seems like the React team’s desire to ship shiny new features has outweighed their desire to produce sound abstractions. It wouldn’t surprise me if Concurrent Mode is released alongside a bizarre hack that enables it to function at all, like a babel transform that restructures your render functions into smaller units to enable interruption.

    In any case, I wish them all the best. Maybe they have some tricks up their sleeves, like authoring the hard parts in a language with a more useful type system.

    1. 3

      Hooks are a completely unsound abstraction that will break if the order of your hook calls change.

      this!!! I was so confused when hooks were announced. I suppose a pro of hooks is that it consildated the API for bad decisions™ compared to the plethora of state management libraries. but then we just ended up with more plethora on top of hooks!!!

      1. 3

        I don’t know. Hooks have nuances, but so do class-based components. And I imagine any UI framework does.