Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shunjizhan committed Sep 13, 2021
1 parent 47dfb97 commit fe738b7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions React/react性能优化.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- [为组件创建错误边界](#为组件创建错误边界)
- [`<li>`加上key](#为li加上key)
- [依赖优化](#依赖优化)
- [总结](#总结)

<!-- /code_chunk_output -->

Expand Down Expand Up @@ -393,3 +394,13 @@ module.exports = override(useBabelRc())
- `1.[hash].chunk.js`: 这是第三方库的代码, 包含你在 node_modules 中导入的模块
- `runtime~main.[hash].js`: webpack运行时代码


## 总结
- memo,shouldComponentUpdate
- 不要用内联函数和内联样式(JS比css慢)
- 给li加上key
- 卸载前进行清理
- 组件懒加载,减少bundle大小
- 使用fragment避免额外标记
- 优化条件渲染
- 错误边界
5 changes: 5 additions & 0 deletions 各种手写.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ async function all(pendings) {
res.push(await p);
}

// 这样也行
// for await (let p of pendings) {
// res.push(p)
// }

return res;
}

Expand Down

0 comments on commit fe738b7

Please sign in to comment.