Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
そのuseEffect、本当に必要?
Search
shirahama
March 23, 2024
Programming
190
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
そのuseEffect、本当に必要?
shirahama
March 23, 2024
Other Decks in Programming
See All in Programming
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
380
ジョジョの世界をXRで再現する
mofurune
0
160
Agents on Rails - Rails at Scale 2026
irinanazarova
0
560
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
160
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
270
IBM Bob でAI駆動開発『QC-Playbook』
ichirokano2
0
110
最近”作らせてる” ローカルAIアプリの話
akit37
0
470
すこし踏み込む CancellationToken
htkym
2
1.7k
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
190
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.6k
Domain-Driven Transformation
hschwentner
2
2.3k
Featured
See All Featured
ラッコキーワード サービス紹介資料
rakko
1
5.3M
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
320
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
490
GitHub's CSS Performance
jonrohan
1033
470k
We Have a Design System, Now What?
morganepeng
55
8.4k
How Software Deployment tools have changed in the past 20 years
geshan
2
35k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
270
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
Why Our Code Smells
bkeepers
PRO
340
58k
The Invisible Side of Design
smashingmag
301
52k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.1k
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を生まれる前に消し去りたい」
ご清聴ありがとうございました