News for hackers. Stuff that matters.
Re:React Concurrent Mode by couchand on Thursday October 24, 2019 @02:29PM (#21347648)
Yes, but don't do it from within your view. Fetch the data you need and provide it to the view.

The standard React application renders a few levels down, investigates the document location and matches against routes, renders a few more levels, discovers there is some necessary data missing, fetches it, renders a few more levels down, realizes there's more data missing, stops and waits for it, etc.

This isn't a failing of React per se, but rather of how people use it.

Re:React Concurrent Mode by crooked-v on Thursday October 24, 2019 @02:42PM (#21347806)
My general lean here has been to use a library like redux-first-router (https://github.com/faceyspacey/redux-first-router) to have this data lookup stuff happen based on routing and existing Redux state, and conditional rendering wrapping for specific components using that data (for example, https://github.com/acdlite/recompose/blob/master/docs/API.md...).
Re:React Concurrent Mode by ng12 on Thursday October 24, 2019 @02:49PM (#21347886)
> Fetch the data you need and provide it to the view.

That's exactly what this feature is doing -- making the view layer more flexible in how it responds to the data received.

Re:React Concurrent Mode by weberc2 on Thursday October 24, 2019 @02:35PM (#21347748)
As an ignorant and neutral bystander, I’m really curious why this is downvoted and would be interested in reading the rebuttal (seems like I could learn something).
Re:React Concurrent Mode by PKop on Thursday October 24, 2019 @02:39PM (#21347780)
Because 4 or 5 years of real world React development have proven them inadequate suggestions.

React itself was created in opposition to arbitrary separation of concerns dogma. The concern is the component, the entity encompassing both UI and data manipulation code, as well as styling. Separating all of these parts into isolation does not result in more maintainable code or better UX.

Re:React Concurrent Mode by couchand on Thursday October 24, 2019 @02:53PM (#21347923)
No, React was created in opposition to the fact that we used to manually update the DOM because that's all we had tools for.
Re:React Concurrent Mode by PKop on Thursday October 24, 2019 @03:05PM (#21348062)
Rethinking best practices absolutely addressed misapplication of separation of concerns.

https://www.youtube.com/watch?v=x7cQ3mrcKaY

Components have always had JSX markup along with data manipulation logic. CSS in JS and styling co-located with component extended this consolidation of cross-cutting concerns.

These, along with not manually updating DOM state as you mention, all fall under declarative aspects of React.. which concurrent rendering and Suspense are consistent with and essentially an extension of.

Re:React Concurrent Mode by mosdl on Thursday October 24, 2019 @08:50PM (#21350732)
No, React was created to allow contractors to write code fast and not worry about optimization.
Re:React Concurrent Mode by chacham15 on Thursday October 24, 2019 @02:46PM (#21347855)
React isnt the one mandating how its used. It can be used in the way that the GP is talking about, but you can also keep the data entirely separate. Redux et al do exactly that. The main thing that the GP is missing is that, like with video games, in order to keep the view rendering smoothly, you need something like double buffering so that if the render isnt complete, you dont block. That is independent of how the data is being provided.