reboottime / React-Develpment

Some notes, thought, articles or source code readings aggregated here about React Web development.
0 stars 0 forks source link

[Advanced React] Intro to rerender #71

Open reboottime opened 5 months ago

reboottime commented 5 months ago

Intro to re-render

This article is part of an advanced React series tutorials.

Major content

reboottime commented 5 months ago

The problem

In the following UI, clicking on the Click Me button takes forever to render the modal

image image
reboottime commented 5 months ago

The fundamental

How react adds, updates and removes component on the screen.

image image image


Be careful with hooks

image
reboottime commented 5 months ago

Solution

Root cause: So the problem happens because the heavier components take a lot of time on re rendering, thus the modal shows slow to the screen

Solution: Minimize the influence scope of rerendering

Solution So the problem happens because the heavier components take a lot of time on re rendering, thus the modal shows slow to the screen

image