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
What the Hook ?
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Adnan A M
July 09, 2020
Programming
110
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
86
A developer's guide to wealth
adnan321
0
300
Scoping Your Storage
adnan321
2
190
What The Context ?
adnan321
2
240
Putting Work Manager To Work
adnan321
0
120
OOP To FP
adnan321
1
230
Putting Work Manager To Work
adnan321
1
220
A slice of Android Slices - droidcon London 2018
adnan321
0
140
Having fun with Kotlin fun()
adnan321
0
130
Other Decks in Programming
See All in Programming
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
220
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
330
スマートフォンでモールス信号を送受信する 〜スマートフォンのLEDとカメラで作る光通信の設計と実装〜
atsuki_seo
0
160
新卒PdEのリアル
ryu1013
1
510
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
190
Security issues being discussed on Web Platforms
petamoriken
0
1k
SREの越境 / SRE Collaboration
y0hgi
2
260
SONY CISC-NEWS NWS-1750 + NWB-225 フレームバッファの NetBSD/news68k ドライバ実装 / OSC2026Hiroshima
tsutsui
0
130
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
290
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
380
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
480
JPUG勉強会 OSSデータベースの内部構造を理解しよう(第2回)
oga5
0
260
Featured
See All Featured
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
550
The Mindset for Success: Future Career Progression
greggifford
PRO
0
500
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
880
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
440
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
エンジニアに許された特別な時間の終わり
watany
109
250k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
540
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Technical Leadership for Architectural Decision Making
baasie
3
570
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