Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Reactの再レンダリングを理解する / Understanding React Re-ren...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
44aki
October 10, 2024
61
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Reactの再レンダリングを理解する / Understanding React Re-rendering
44aki
October 10, 2024
More Decks by 44aki
See All by 44aki
個人開発でDevinに20ドル課金してみた / Devin starting at $20
44aki
0
61
Hotwire入門 Part1 / Introduction to Hotwire Part 1
44aki
0
60
Dev Containerを使ってみよう / Let's try Dev Container!
44aki
0
39
プロダクト開発における振り返り手法 / Reflection Methods in Product Development
44aki
0
58
プロダクト開発におけるエンジニアリングマネージャー(EM)の役割 / Role of the Engineering Manager in Product Development
44aki
0
110
MVP開発とWhy,What,Howの考え方 / MVP Development and the why, what, how concept
44aki
0
160
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Ruling the World: When Life Gets Gamed
codingconduct
0
300
Faster Mobile Websites
deanohume
310
32k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.2k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
WCS-LA-2024
lcolladotor
0
800
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Raft: Consensus for Rubyists
vanstee
141
7.6k
Agile that works and the tools we love
rasmusluckow
331
22k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
350
Measuring & Analyzing Core Web Vitals
bluesmoon
9
960
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
480
Transcript
Reactの再レンダリングを理解する Understanding React Re-rendering
Reactには2種類のレンダリングがある 初回レンダリング E コンポーネントが最初に画面に表示されるタイミングで発生 再レンダリング E 既に表示されているコンポーネントが更新されたタイミングで発v E 今回のLTで話したいテーマはこちら
Component1 の count が更新された時に 再レンダリングされるコンポーネントはどれ Á ComponentÅ Á Component Á
Component3 再レンダリングに関するクイズ
Component1 の count が更新された時に 再レンダリングされるコンポーネントはどれ Á ComponentÅ Á Component Á
Component3 正解: 全部 親コンポーネントの state が更新されると 親コンポーネント以下は全て再レンダリングされる 再レンダリングに関するクイズ
state 管理を子コンポーネントで行うことで 再レンダリングの範囲を最小限にできる state管理はなるべく子コンポーネントで行う
memo 化したコンポーネントは props の値が 変わらない限りは前回の描画結果をキャッシュする memo化で再描画を抑えることも可能
useStat9 6 主に狭い範囲のスコープでの state 管理に使& 6 親、子、孫コンポーネント間の値の受け渡しで props リレーが発生しがÇ 6
props リレーをしたコンポーネント配下全てで再描画が発生 useContex 6 同一画面内での state 管理など広い範囲のスコープでの state 管理に使& 6 useContext で state を取得できるため props リレーが不h 6 stateが更新された際に context 配下全てで再レンダリングされる点は useState と同じ Redux、Recoilなどのライブラリを使Ô 6 アプリケーション全体の state 管理や useContext の代替として使& 6 React の管理外で state 管理を行い、孫コンポーネントが直接 state を取得できるため props リレーが不h 6 再レンダリングが発生するのは state を取得したコンポーネント配下のみ その他のstate管理を紹介
再レンダリングを理解して アプリケーションを高速化しよう