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
What the Hook ?
Search
Adnan A M
July 09, 2020
Programming
100
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
What the Hook ?
React Hooks presentation
Adnan A M
July 09, 2020
More Decks by Adnan A M
See All by Adnan A M
Abridge Coding Guidelines
adnan321
0
73
A developer's guide to wealth
adnan321
0
290
Scoping Your Storage
adnan321
2
190
What The Context ?
adnan321
2
240
Putting Work Manager To Work
adnan321
0
110
OOP To FP
adnan321
1
220
Putting Work Manager To Work
adnan321
1
190
A slice of Android Slices - droidcon London 2018
adnan321
0
130
Having fun with Kotlin fun()
adnan321
0
120
Other Decks in Programming
See All in Programming
ふつうのFeature Flag実践入門
irof
8
4.2k
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
150
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
180
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
170
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
580
Creating Composable Callables in Contemporary C++
rollbear
0
170
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
120
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
130
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
220
Vite+ Unified Toolchain for the Web
naokihaba
0
360
1B+ /day規模のログを管理する技術
broadleaf
0
110
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
37
7.3k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
Faster Mobile Websites
deanohume
310
32k
GraphQLとの向き合い方2022年版
quramy
50
15k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
170
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
420
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
1.8k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Scaling GitHub
holman
464
140k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
210
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
470
Transcript
W at he oo ? A 2 1
B ck ro nd A 2 2
C as C mp ne ts 4 c c 4
s (p ) 4 b m (O s a f n ) A 2 3
W at's ro g ? 4 L c l l
4 D t m e l l m 4 I m c o 4 S o l (H /r p a.k.a W l !) A 2 4
E te H ok ! A 2 5
W at s H ok ? A 2 6
P ai o d un ti n A 2 7
H w oe t at el ? 4 N e
o a c c & s (p ) 4 N 't ' A 2 8
W at bo t ta e & l fe yc
e ? import { useState } from 'react'; import { useEffect } from 'react'; import { useYourImagination } from 'yourImagination'; A 2 9
u eS at F h s p import { useState
} from 'react'; const [isLoading, setLoading] = useState(false); const [duration, setDuration] = useState(0); <p>You ran for {duration} minutes</p> <button onClick={() => setDuration(duration + 1)}>Add 1 Min</button> A 2 1
u eS at S c o import { useState }
from 'react'; const [encounter, setEncounter] = useState({ id: uuidv4(), period: { start: moment().valueOf() }, recordings: [], }); A 2 1
u eS at G import { useState } from 'react';
const [duration, setDuration] = useState(0); <button onClick={() => setDuration(duration + 1)}>Add 1 Min</button> R s s i M ! A 2 1
u eE e t import { useEffect } from 'react';
useEffect(() => { start(); }); A 2 1
u eE e t 4 R a e r i
n h s 4 H a s & p i h c n 4 E r c a e i e h e e t e A 2 1
u eE e t - c ea up useEffect(() =>
{ EventListener.subscribe(); return function cleanup() { EventListener.unsubscribe(); } }); A 2 1
u eE e t - O ti is d I
P a import { useEffect } from 'react'; useEffect(() => { start(); }, [props.someElement]); A 2 1
R le f r oo s 4 O l o
R F n 4 D 't l h i l , c o n f n A 2 1
D n t oo ! import { useEffect } from
'react'; // ! We're breaking the rule by using a Hook in conditions if (props.micAuthorized) { useEffect(function startOp() { start(); },[props.micAuthorized]); } A 2 1
R le f r oo s import { useEffect }
from 'react'; useEffect(() => { if (props.micAuthorized) { start(); } }, [props.micAuthorized]); A 2 1
C st m oo s import { BackHandler } from
'react-native'; componentDidMount() { this.backHandler = BackHandler.addEventListener('hardwareBackPress', this.handleAndroidBackPress); } componentWillUnmount() { this.backHandler.remove(); } A 2 2
C st m oo s import { useEffect } from
'react'; import { BackHandler } from 'react-native'; function useBackButton(handler) { useEffect(() => { BackHandler.addEventListener('hardwareBackPress', handler); return () => { BackHandler.removeEventListener('hardwareBackPress',handler); }; }, [handler]); } useBackButton(handleAndroidBackPress); A 2 2
P rt ng ho gh s... ! 4 T a
t s n n r a l l ☠ 4 T e e s n a u a e r " 4 S s c n r o e e y f n c n A 2 2
T an y u ! A 2 2