Re:The Plan for React 18
by danabramov on Tuesday June 08, 2021 @02:50PM
(#27439268)
>I'm excited about concurrent mode.
Tiny nitpick--we'd like to stop referring to it as a "mode" since the new gradual strategy is opt-in per feature. :-)
>As a result, once values arrive it'll kind of cycle through each rendered value rapidly before stopping at the last one.
Have you tried the latest alpha? The behavior you're describing sounds like a bug we fixed a few months ago. See https://github.com/facebook/react/issues/17185#issuecomment-....
Re:The Plan for React 18
by steve_adams_86 on Tuesday June 08, 2021 @06:05PM
(#27441598)
That's exactly it! Thank you!
> Tiny nitpick
Haha, 10-4 - I'll drop the habit
One thing I need to wrap my head around is avoiding unnecessary work with useDeferredValue, for example. I've got something set up which will defer multiple values, but I know the user will only want the most recent value by the time something can render. As a result, once values arrive it'll kind of cycle through each rendered value rapidly before stopping at the last one. I guess I need to implement some sort of throttling and/or debouncing under the hood better - this probably isn't up to concurrent mode to solve for me.
I'm glad to see batching being focused on. I have code which implements batching to some degree, and it's always struck me as so awkward that I can't rely on React to make good decisions for me in this area. The abstraction required in a context provider or component to accomplish this is fairly ugly and really gets in the way of focusing on the component's core responsibility. I think this will be a great improvement.