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
37
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
How Hooks Work under the Hood?
公司內部 React workshop 分享
miycctwn
August 25, 2020
More Decks by miycctwn
See All by miycctwn
自己的工具自己造,咱們來造 React Hooks!
mindytai
0
63
Other Decks in Programming
See All in Programming
1B+ /day規模のログを管理する技術
broadleaf
0
120
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
970
A2UI という光を覗いてみる
satohjohn
1
160
才能?センス?知らん、 続けたもん勝ちだ。-- 結婚・出産・癌を越えてなお、私がプロダクトを創り続ける理由
16bitidol
1
460
Strategic Design in the Frontend: Moduliths & Micro Frontends @DDDEurope
manfredsteyer
PRO
0
130
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
7.1k
Datadog LLM Observabilityで実現する 安全なLLM Usage 管理
3150
0
120
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
130
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
5.4k
act1-costs.pdf
sumedhbala
0
120
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
170
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
230
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
PRO
55
12k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
400
Deep Space Network (abreviated)
tonyrice
0
210
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
370
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.1k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
180
Paper Plane
katiecoart
PRO
1
52k
Designing for Timeless Needs
cassininazir
1
260
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
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)