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
Architectural Extensions
denyspoltorak
0
290
CSC307 Lecture 03
javiergs
PRO
1
490
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
310
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
1
100
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.6k
要求定義・仕様記述・設計・検証の手引き - 理論から学ぶ明確で統一された成果物定義
orgachem
PRO
1
150
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
180
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.8k
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
620
Apache Iceberg V3 and migration to V3
tomtanaka
0
160
MUSUBIXとは
nahisaho
0
140
Featured
See All Featured
Game over? The fight for quality and originality in the time of robots
wayneb77
1
120
ラッコキーワード サービス紹介資料
rakko
1
2.3M
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
0
260
Statistics for Hackers
jakevdp
799
230k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
30 Presentation Tips
portentint
PRO
1
220
Six Lessons from altMBA
skipperchong
29
4.2k
Amusing Abliteration
ianozsvald
0
100
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.4k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
240
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)