Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is sideways data loading in React?

Tags:

reactjs

There are a few scattered references to "sideways data loading" in various React issues and elsewhere, but I haven't found a concise description of exactly what is meant by this term. Can someone clarify?

like image 764
Matthew Gertner Avatar asked Jul 23 '15 09:07

Matthew Gertner


People also ask

What is suspense and lazy in React?

Suspense is a component for wrapping lazy components. You can wrap multiple lazy components at different hierarchy levels with a single Suspense component. The Suspense component takes a fallback prop that accepts the React elements you want rendered as placeholder content while all the lazy components get loaded.

What is the use of suspense in React?

Suspense is not a data fetching library. It's a mechanism for data fetching libraries to communicate to React that the data a component is reading is not ready yet. React can then wait for it to be ready and update the UI.

What is async rendering in React?

This means that while the component Shows is waiting for some asynchronous operation, such as fetching shows from TVMaze's API, React will render <p>loading... </p> to the DOM instead. The Shows component is then rendered only after the promises and APIs are resolved.


1 Answers

sideways loading is the concept that data is pushed directly to specific components, instead of from the parents (as is done in the initial rendering / vanilla react without subscriptions or observables). So basically you are not re-rendering the app again from the root, but only a specific part of your component tree.

One approach to achieve this is using observables as described here, and some flux frameworks help you with this as well.

like image 72
mweststrate Avatar answered Sep 18 '22 10:09

mweststrate