Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does React remove asynchronous behavior?

I have been reading this, and I came across a line in the Redux documentation

Libraries like React attempt to solve this problem in the view layer by removing both asynchrony and direct DOM manipulation.

I understood the part where React does not allow DOM manipulations as it abstracts the actual rendering using the render() method. I am confused with the second part.

How does React remove the asynchrony? Can someone please explain with examples or valid use cases.

like image 509
Subham Tripathi Avatar asked Mar 18 '26 13:03

Subham Tripathi


1 Answers

It removes asynchronous behavior from the view layer by design. You must not do async stuff in render or what is rendered will be broken.

Libraries like React attempt to solve this problem in the view layer by removing both asynchrony and direct DOM manipulation [from the render method].

You are missing the last sentence which gives further explanations:

However, managing the state of your data is left up to you. This is where Redux enters.

To wrap up, there must be no async calls in render method but there can be some async stuff happening in the state management part handled by Redux. You can't do async stuff in the render method by design. If you you do so it won't work.

like image 111
amirouche Avatar answered Mar 20 '26 01:03

amirouche