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
How Hooks Work under the Hood?
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
miycctwn
August 25, 2020
Programming
0
35
How Hooks Work under the Hood?
公司內部 React workshop 分享
miycctwn
August 25, 2020
Tweet
Share
More Decks by miycctwn
See All by miycctwn
自己的工具自己造,咱們來造 React Hooks!
mindytai
0
58
Other Decks in Programming
See All in Programming
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
3.9k
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
5
750
Grafana:建立系統全知視角的捷徑
blueswen
0
330
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
140
Package Management Learnings from Homebrew
mikemcquaid
0
230
AIによる高速開発をどう制御するか? ガードレール設置で開発速度と品質を両立させたチームの事例
tonkotsuboy_com
7
2.4k
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
180
AI & Enginnering
codelynx
0
110
CSC307 Lecture 06
javiergs
PRO
0
690
CSC307 Lecture 10
javiergs
PRO
1
660
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.6k
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
1
2.6k
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.9k
The Cult of Friendly URLs
andyhume
79
6.8k
We Have a Design System, Now What?
morganepeng
54
8k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
68
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
76
Scaling GitHub
holman
464
140k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
450
Code Review Best Practice
trishagee
74
20k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
170
Producing Creativity
orderedlist
PRO
348
40k
Speed Design
sergeychernyshev
33
1.5k
Transcript
How Hooks Work under the Hood?
01 JS Closure
Scope Chain 切分變數最有效範圍是 function
試看以下程式碼
None
內層的 function 可以讀取外層宣告的變數 但外層的 outer function 存取不到內層變數 若是自己層級找不到會一層一層往外找 直到 Global
None
function 是被定義的當下決定的 並不是被呼叫才被定義
Closure 當 inner function 被回傳後 可以取得內部函式環境裡的變數值 記住了當時的環境 這就是閉包!
0 2 useState
None
如果要更貼近真實的 React Hook API state 必須要為變數
None
Module Pattern Javascript Design Pattern
None
Ref 1. Deep dive: How do React hooks really work?
2. 0 陷阱!0 誤解!8 天重新認識 JavaScript!- 許國政 (Kuro)