SlideShare a Scribd company logo
INTRODUCTIONTO REACT HOOKS
Felicia O’Garro | Code Crew | March 25, 2021
WHAT ARE REACT HOOKS?
• New addition in React 16.
8

• Functions that let you “hook into” React features from function component
s

• They don’t work inside of classe
s

• No breaking changes or rewrite
s

• You can build your own
REACT HOOKS API
• useStat
e

• useEffec
t

• useContex
t

• useReduce
r

• useCallbac
k

• useMem
o

• useRe
f

• useImperativeHandl
e

• useLayoutEffec
t

• useDebugValue
WHY HOOKS?
• Allows you to reuse stateful logic without changing your component
hierarchy
 

• Allows you to break larger components down to smaller function
s

• You can use more of React features without using classes
STATE IN CLASS COMPONENTS
USE STATE
• Used to add local state to a function
component
 

• State is preserved during re-render
s

• Returns the current state value and a
function that lets you update it
ARRAY DESTRUCTURING
• Allows us to assign different names to
the state variables declared by calling
useStat
e

• Extract representations from the data
fed into layers
USE STATE IN ACTION
USE EFFECT
• Adds the ability to perform side effects
from a functio
n

• Serves the same purpose as certain
lifecycle hooks
LIFECYLE METHODS
SIDE EFFECTS IN CLASS COMPONENTS
EFFECTS RENDERING
• [] - only run during initial rende
r

• nothing - run during initial render and after every re-rende
r

• [data] - run at initial render and after every re-render if data has
changed since the last re-render
USE EFFECT IN ACTION
RULES OF HOOKS
• Only call Hooks at the top level
 

• Only call Hooks from React functional component
s

• ESLint con
fi
guration
RESOURCES
• React Docs
• Modern React with Redux Course
• Full React Course 2020
• React Lifecycle Methods Diagram
THANKS MUCH!!!

More Related Content

What's hot

React with Redux
React with ReduxReact with Redux
React with Redux
Stanimir Todorov
 
Understanding React hooks | Walkingtree Technologies
Understanding React hooks | Walkingtree TechnologiesUnderstanding React hooks | Walkingtree Technologies
Understanding React hooks | Walkingtree Technologies
Walking Tree Technologies
 
React-JS Component Life-cycle Methods
React-JS Component Life-cycle MethodsReact-JS Component Life-cycle Methods
React-JS Component Life-cycle Methods
ANKUSH CHAVAN
 
TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the pain
Sander Mak (@Sander_Mak)
 
Important React Hooks
Important React HooksImportant React Hooks
Important React Hooks
Knoldus Inc.
 
React js
React jsReact js
React js
Nikhil Karkra
 
Angular 4 and TypeScript
Angular 4 and TypeScriptAngular 4 and TypeScript
Angular 4 and TypeScript
Ahmed El-Kady
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooks
Maulik Shah
 
Javascript Module Patterns
Javascript Module PatternsJavascript Module Patterns
Javascript Module Patterns
Nicholas Jansma
 
ES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern Javascript
Wojciech Dzikowski
 
State management in react applications (Statecharts)
State management in react applications (Statecharts)State management in react applications (Statecharts)
State management in react applications (Statecharts)
Tomáš Drenčák
 
Introduction to react and redux
Introduction to react and reduxIntroduction to react and redux
Introduction to react and redux
Cuong Ho
 
React workshop presentation
React workshop presentationReact workshop presentation
React workshop presentation
Bojan Golubović
 
Dockerfile
Dockerfile Dockerfile
Dockerfile
Jeffrey Ellin
 
Introduction to ASP.NET Core
Introduction to ASP.NET CoreIntroduction to ASP.NET Core
Introduction to ASP.NET Core
Avanade Nederland
 
TypeScript Presentation
TypeScript PresentationTypeScript Presentation
TypeScript Presentation
Patrick John Pacaña
 
Intégration continue et déploiement continue avec Jenkins
Intégration continue et déploiement continue avec JenkinsIntégration continue et déploiement continue avec Jenkins
Intégration continue et déploiement continue avec Jenkins
Kokou Gaglo
 
.Net Core
.Net Core.Net Core
.Net Core
Bertrand Le Roy
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
Badoo
 
Build web apps with react js
Build web apps with react jsBuild web apps with react js
Build web apps with react js
dhanushkacnd
 

What's hot (20)

React with Redux
React with ReduxReact with Redux
React with Redux
 
Understanding React hooks | Walkingtree Technologies
Understanding React hooks | Walkingtree TechnologiesUnderstanding React hooks | Walkingtree Technologies
Understanding React hooks | Walkingtree Technologies
 
React-JS Component Life-cycle Methods
React-JS Component Life-cycle MethodsReact-JS Component Life-cycle Methods
React-JS Component Life-cycle Methods
 
TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the pain
 
Important React Hooks
Important React HooksImportant React Hooks
Important React Hooks
 
React js
React jsReact js
React js
 
Angular 4 and TypeScript
Angular 4 and TypeScriptAngular 4 and TypeScript
Angular 4 and TypeScript
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooks
 
Javascript Module Patterns
Javascript Module PatternsJavascript Module Patterns
Javascript Module Patterns
 
ES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern Javascript
 
State management in react applications (Statecharts)
State management in react applications (Statecharts)State management in react applications (Statecharts)
State management in react applications (Statecharts)
 
Introduction to react and redux
Introduction to react and reduxIntroduction to react and redux
Introduction to react and redux
 
React workshop presentation
React workshop presentationReact workshop presentation
React workshop presentation
 
Dockerfile
Dockerfile Dockerfile
Dockerfile
 
Introduction to ASP.NET Core
Introduction to ASP.NET CoreIntroduction to ASP.NET Core
Introduction to ASP.NET Core
 
TypeScript Presentation
TypeScript PresentationTypeScript Presentation
TypeScript Presentation
 
Intégration continue et déploiement continue avec Jenkins
Intégration continue et déploiement continue avec JenkinsIntégration continue et déploiement continue avec Jenkins
Intégration continue et déploiement continue avec Jenkins
 
.Net Core
.Net Core.Net Core
.Net Core
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
 
Build web apps with react js
Build web apps with react jsBuild web apps with react js
Build web apps with react js
 

Similar to Introduction to React Hooks

React-JS.pptx
React-JS.pptxReact-JS.pptx
React-JS.pptx
AnmolPandita7
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
Karmanjay Verma
 
Importance of Hook in Recat Js.pdf
Importance of Hook in Recat Js.pdfImportance of Hook in Recat Js.pdf
Importance of Hook in Recat Js.pdf
Nishaadequateinfosof
 
Basic React Knowledge.
Basic React Knowledge.Basic React Knowledge.
Basic React Knowledge.
jacobryne
 
ReactJs Training in Hyderabad | ReactJS Training
ReactJs Training in Hyderabad  | ReactJS TrainingReactJs Training in Hyderabad  | ReactJS Training
ReactJs Training in Hyderabad | ReactJS Training
eshwarvisualpath
 
How To Upgrade The React 18 Release Candidate.pptx
How To Upgrade The React 18 Release Candidate.pptxHow To Upgrade The React 18 Release Candidate.pptx
How To Upgrade The React 18 Release Candidate.pptx
BOSC Tech Labs
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooks
Samundra khatri
 
Basic React Knowledge.
Basic React Knowledge.Basic React Knowledge.
Basic React Knowledge.
jacobryne
 
React Hooks Best Practices in 2022.pptx
React Hooks Best Practices in 2022.pptxReact Hooks Best Practices in 2022.pptx
React Hooks Best Practices in 2022.pptx
BOSC Tech Labs
 
React
ReactReact
An Overview of the React Ecosystem
An Overview of the React EcosystemAn Overview of the React Ecosystem
An Overview of the React Ecosystem
FITC
 
Will React Hooks replace Redux?
Will React Hooks replace Redux?Will React Hooks replace Redux?
Will React Hooks replace Redux?
Trivikram Kamat
 
Reactjs notes.pptx for web development- tutorial and theory
Reactjs  notes.pptx for web development- tutorial and theoryReactjs  notes.pptx for web development- tutorial and theory
Reactjs notes.pptx for web development- tutorial and theory
jobinThomas54
 
FRONTEND BOOTCAMP 4.pptx
FRONTEND BOOTCAMP 4.pptxFRONTEND BOOTCAMP 4.pptx
FRONTEND BOOTCAMP 4.pptx
Ehtesham46
 
React Class Components vs Functional Components: Which is Better?
React Class Components vs Functional Components: Which is Better?React Class Components vs Functional Components: Which is Better?
React Class Components vs Functional Components: Which is Better?
Fibonalabs
 
React Interview Question & Answers PDF By ScholarHat
React Interview Question & Answers PDF By ScholarHatReact Interview Question & Answers PDF By ScholarHat
React Interview Question & Answers PDF By ScholarHat
Scholarhat
 
Spfx with react redux
Spfx with react reduxSpfx with react redux
Spfx with react redux
Rajesh Kumar
 
Corso su ReactJS
Corso su ReactJSCorso su ReactJS
Corso su ReactJS
LinkMe Srl
 
downloads_introduction to redux.pptx
downloads_introduction to redux.pptxdownloads_introduction to redux.pptx
downloads_introduction to redux.pptx
NavneetKumar111924
 
Introduction to React JS.pptx
Introduction to React JS.pptxIntroduction to React JS.pptx
Introduction to React JS.pptx
SHAIKIRFAN715544
 

Similar to Introduction to React Hooks (20)

React-JS.pptx
React-JS.pptxReact-JS.pptx
React-JS.pptx
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Importance of Hook in Recat Js.pdf
Importance of Hook in Recat Js.pdfImportance of Hook in Recat Js.pdf
Importance of Hook in Recat Js.pdf
 
Basic React Knowledge.
Basic React Knowledge.Basic React Knowledge.
Basic React Knowledge.
 
ReactJs Training in Hyderabad | ReactJS Training
ReactJs Training in Hyderabad  | ReactJS TrainingReactJs Training in Hyderabad  | ReactJS Training
ReactJs Training in Hyderabad | ReactJS Training
 
How To Upgrade The React 18 Release Candidate.pptx
How To Upgrade The React 18 Release Candidate.pptxHow To Upgrade The React 18 Release Candidate.pptx
How To Upgrade The React 18 Release Candidate.pptx
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooks
 
Basic React Knowledge.
Basic React Knowledge.Basic React Knowledge.
Basic React Knowledge.
 
React Hooks Best Practices in 2022.pptx
React Hooks Best Practices in 2022.pptxReact Hooks Best Practices in 2022.pptx
React Hooks Best Practices in 2022.pptx
 
React
ReactReact
React
 
An Overview of the React Ecosystem
An Overview of the React EcosystemAn Overview of the React Ecosystem
An Overview of the React Ecosystem
 
Will React Hooks replace Redux?
Will React Hooks replace Redux?Will React Hooks replace Redux?
Will React Hooks replace Redux?
 
Reactjs notes.pptx for web development- tutorial and theory
Reactjs  notes.pptx for web development- tutorial and theoryReactjs  notes.pptx for web development- tutorial and theory
Reactjs notes.pptx for web development- tutorial and theory
 
FRONTEND BOOTCAMP 4.pptx
FRONTEND BOOTCAMP 4.pptxFRONTEND BOOTCAMP 4.pptx
FRONTEND BOOTCAMP 4.pptx
 
React Class Components vs Functional Components: Which is Better?
React Class Components vs Functional Components: Which is Better?React Class Components vs Functional Components: Which is Better?
React Class Components vs Functional Components: Which is Better?
 
React Interview Question & Answers PDF By ScholarHat
React Interview Question & Answers PDF By ScholarHatReact Interview Question & Answers PDF By ScholarHat
React Interview Question & Answers PDF By ScholarHat
 
Spfx with react redux
Spfx with react reduxSpfx with react redux
Spfx with react redux
 
Corso su ReactJS
Corso su ReactJSCorso su ReactJS
Corso su ReactJS
 
downloads_introduction to redux.pptx
downloads_introduction to redux.pptxdownloads_introduction to redux.pptx
downloads_introduction to redux.pptx
 
Introduction to React JS.pptx
Introduction to React JS.pptxIntroduction to React JS.pptx
Introduction to React JS.pptx
 

More from Felicia O'Garro

Introduction to Deep Learning
Introduction to Deep LearningIntroduction to Deep Learning
Introduction to Deep Learning
Felicia O'Garro
 
Intro to Electron - Creating Desktop Applications with HTML5
Intro to Electron - Creating Desktop Applications with HTML5Intro to Electron - Creating Desktop Applications with HTML5
Intro to Electron - Creating Desktop Applications with HTML5
Felicia O'Garro
 
Getting Started with Vue.js
Getting Started with Vue.jsGetting Started with Vue.js
Getting Started with Vue.js
Felicia O'Garro
 
Hello Girl - 4 Session Beginner Workshop (Session 3)
Hello Girl - 4 Session Beginner Workshop (Session 3)Hello Girl - 4 Session Beginner Workshop (Session 3)
Hello Girl - 4 Session Beginner Workshop (Session 3)
Felicia O'Garro
 
Hello Girl - 4 Session Beginner Workshop (Session 1)
Hello Girl - 4 Session Beginner Workshop (Session 1)Hello Girl - 4 Session Beginner Workshop (Session 1)
Hello Girl - 4 Session Beginner Workshop (Session 1)
Felicia O'Garro
 
Hello Girl Intro to Programming
Hello Girl Intro to ProgrammingHello Girl Intro to Programming
Hello Girl Intro to Programming
Felicia O'Garro
 

More from Felicia O'Garro (6)

Introduction to Deep Learning
Introduction to Deep LearningIntroduction to Deep Learning
Introduction to Deep Learning
 
Intro to Electron - Creating Desktop Applications with HTML5
Intro to Electron - Creating Desktop Applications with HTML5Intro to Electron - Creating Desktop Applications with HTML5
Intro to Electron - Creating Desktop Applications with HTML5
 
Getting Started with Vue.js
Getting Started with Vue.jsGetting Started with Vue.js
Getting Started with Vue.js
 
Hello Girl - 4 Session Beginner Workshop (Session 3)
Hello Girl - 4 Session Beginner Workshop (Session 3)Hello Girl - 4 Session Beginner Workshop (Session 3)
Hello Girl - 4 Session Beginner Workshop (Session 3)
 
Hello Girl - 4 Session Beginner Workshop (Session 1)
Hello Girl - 4 Session Beginner Workshop (Session 1)Hello Girl - 4 Session Beginner Workshop (Session 1)
Hello Girl - 4 Session Beginner Workshop (Session 1)
 
Hello Girl Intro to Programming
Hello Girl Intro to ProgrammingHello Girl Intro to Programming
Hello Girl Intro to Programming
 

Recently uploaded

Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
University of Maribor
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
rpskprasana
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
Las Vegas Warehouse
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
Aditya Rajan Patra
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
JamalHussainArman
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
zubairahmad848137
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 

Recently uploaded (20)

Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 

Introduction to React Hooks

  • 1. INTRODUCTIONTO REACT HOOKS Felicia O’Garro | Code Crew | March 25, 2021
  • 2. WHAT ARE REACT HOOKS? • New addition in React 16. 8 • Functions that let you “hook into” React features from function component s • They don’t work inside of classe s • No breaking changes or rewrite s • You can build your own
  • 3. REACT HOOKS API • useStat e • useEffec t • useContex t • useReduce r • useCallbac k • useMem o • useRe f • useImperativeHandl e • useLayoutEffec t • useDebugValue
  • 4. WHY HOOKS? • Allows you to reuse stateful logic without changing your component hierarchy • Allows you to break larger components down to smaller function s • You can use more of React features without using classes
  • 5. STATE IN CLASS COMPONENTS
  • 6. USE STATE • Used to add local state to a function component • State is preserved during re-render s • Returns the current state value and a function that lets you update it
  • 7. ARRAY DESTRUCTURING • Allows us to assign different names to the state variables declared by calling useStat e • Extract representations from the data fed into layers
  • 8. USE STATE IN ACTION
  • 9. USE EFFECT • Adds the ability to perform side effects from a functio n • Serves the same purpose as certain lifecycle hooks
  • 11. SIDE EFFECTS IN CLASS COMPONENTS
  • 12. EFFECTS RENDERING • [] - only run during initial rende r • nothing - run during initial render and after every re-rende r • [data] - run at initial render and after every re-render if data has changed since the last re-render
  • 13. USE EFFECT IN ACTION
  • 14. RULES OF HOOKS • Only call Hooks at the top level • Only call Hooks from React functional component s • ESLint con fi guration
  • 15.
  • 16. RESOURCES • React Docs • Modern React with Redux Course • Full React Course 2020 • React Lifecycle Methods Diagram