Skip to content

Commit

Permalink
feat: Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
L-Qun committed Aug 28, 2024
1 parent 727a321 commit 8eead90
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,15 @@ const Content = () => {
<img src="./img/before-optimization.gif" width="400">
</div>

When we click the button, the rendering seems a bit laggy, right? That's because we need to wait for all the components to render. But not all components have the same priority. A better way is to render the important content first, and then the rest, the more important content will be shown more quickly.
When we click the button, the rendering seems a bit laggy, right? That's because we need to wait for all the components to render.

When we open the Chrome Performance tool, we can see:

<div align="center">
<img src="./img/before-optimization-performance.png" width="400">
</div>

This means it is not good for the user experience. But not all components have the same priority. A better way is to render the important content first, and then the rest, the more important content will be shown more quickly.

Let's say the priority of those components is Content > Sidebar > Header = Footer, then we can pass a `priority` field to represent the priority of each component.

Expand Down Expand Up @@ -143,4 +151,10 @@ const Content = () => {
<img src="./img/after-optimization.gif" width="400">
</div>

When we open the Chrome Performance tool, we can see:

<div align="center">
<img src="./img/after-optimization-performance.png" width="400">
</div>

The performance is better. Important content will be displayed to users more quickly, thereby providing a better user experience.
Binary file added img/after-optimization-performance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/before-optimization-performance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8eead90

Please sign in to comment.