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
そのuseEffect、本当に必要?
Search
shirahama
March 23, 2024
Programming
0
180
そのuseEffect、本当に必要?
shirahama
March 23, 2024
Tweet
Share
Other Decks in Programming
See All in Programming
ご飯食べながらエージェントが開発できる。そう、Agentic Engineeringならね。
yokomachi
1
290
Ruby x Terminal
a_matsuda
7
580
Windows on Ryzen and I
seosoft
0
140
CSC307 Lecture 13
javiergs
PRO
0
310
AI主導でFastAPIのWebサービスを作るときに 人間が構造化すべき境界線
okajun35
0
580
Codex の「自走力」を高める
yorifuji
0
800
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.6k
手戻りゼロ? Spec Driven Developmentとは@KAG AI week
tmhirai
1
170
AWS Infrastructure as Code の新機能 2025 総まとめ 〜SA 4人による怒涛のデモ祭り〜
konokenj
10
3.2k
Event Storming
hschwentner
3
1.3k
オブザーバビリティ駆動開発って実際どうなの?
yohfee
3
700
PJのドキュメントを全部Git管理にしたら、一番喜んだのはAIだった
nanaism
0
240
Featured
See All Featured
Optimizing for Happiness
mojombo
378
71k
Why Our Code Smells
bkeepers
PRO
340
58k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
190
How to train your dragon (web standard)
notwaldorf
97
6.5k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
200
Scaling GitHub
holman
464
140k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
The browser strikes back
jonoalderson
0
760
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
170
Agile that works and the tools we love
rasmusluckow
331
21k
Skip the Path - Find Your Career Trail
mkilby
1
72
Automating Front-end Workflow
addyosmani
1370
200k
Transcript
そのuseEffect、本当に必要? shirahama
今日話すテーマ useEffectについて
useEffectとは
useEffect はコンポーネントを外部システムと同期させるための React フック
useEffectの依存配列に変更を検知したい値を入れて 何らかの処理を行うような使い方は正しくない
None
悪い例
useEffectでfirstName、lastNameの変更を検知してfullNameを更新する Bad Pattern
propsやstateといったReact内部の値に基づいた処理は • 必要以上に複雑になる (子コンポーネント、孫コンポーネントまで関連してくると処理を追うのが辛い。。。) • 余計な再レンダリングが起きる
良い例
レンダリング中に計算する Good Pattern
そのuseEffect、本当に必要? React Docs: https://ja.react.dev/learn/you-might-not-need-an-effect
128個のuseEffectをランダムにチェックしたところ59個は不要なものだったらしい
「全てのuseEffectを生まれる前に消し去りたい」
ご清聴ありがとうございました