SlideShare a Scribd company logo
REACT HOOKS
TECH47.IN & RAZORPAY
JAIKANT
KUMARAN
@JAIKANTKUMARAN
JAI@TECH47.IN
LOGISTICS
‣ Use the “General” Channel on Slack to post questions at any
point.
‣ I may ask you to refer code which is in the ‘react-hooks’ channel.
‣ We end when the talks end or by 5pm. Which ever occurs earlier.
INTRODUCTION TO HOOKS
QUESTIONS?
WHAT ARE HOOKS
Hooks lets you use state and other React features
without writing a class.
WHAT ARE HOOKS
HOOKS LET YOU WRITE STATEFUL,
FEATURE RICH FUNCTION COMPONENTS.
REACT COMPONENTS
REACT COMPONENTS
▸ CLASS COMPONENTS
▸ FUNCTION COMPONENTS
() => <div> Hi </div>
() => {
fetch('someurl');
return <div> Hi </div>;
};
Why class components - Is this good?
REACT CLASS
CLASS COMPONENT
▸ LIFE CYCLE METHODS
▸ `THIS`
▸ STATE
▸ ComponentDidMount
▸ ComponentDidUpdate
▸ComponentWillUnmount
▸…
▸ RENDER METHOD
this.state
React Classes!
this.setState(newState)
() => <div> Hi </div>
() => {
// Can do other things
return <div> Hi </div>;
};
Function Components
REACT CLASS
HOOKS
EARLIER NOW
state, setState useState
componentDidMount useEffect
componentDidUpdate useEffect
componentWillUnmount useEffect
THE SOLUTION NOW
SOME HOOKS
▸ useState
▸ useReducer
▸ useEffect
▸ useRef
▸ Custom hooks
▸useContext, useCallback, useMemo, useLayoutEffect, useImperativeHandle,
useDebugValue
WHY ARE REACT
COMPONENTS MOVING
FROM CLASSES TO HOOKS?
BETTER SOLUTION?
PROBLEMS WITH CLASSES
‣ Not possible to break the components
into smaller components as the
stateful logic is all over the
place.
‣ Classes confuse both people and machines
‣ Classes don’t minify well
‣ Make hot reloading flaky and unreliable
Hooks don’t use classes.
BETTER SOLUTION?
EXPLICIT DATA FLOW & COMPOSITION PROBLEMS WITHIN COMPONENTS
‣ Mutually related code, that changes
together gets split apart.
‣ Unrelated code ends up combined in a
single method.
Hooks lets us organise related code in a
component together. (useEffect)
BETTER SOLUTION?
EXPLICIT DATA FLOW & COMPOSITION WITHIN COMPONENTS
BETTER SOLUTION?
EXPLICIT DATA FLOW & COMPOSITION WITHIN COMPONENTS
React.js hooks feb 23rd meetup


REUSABILITY
REUSABILITY
- How do we reuse code in React?
- If components are re-usable, why do
we need hooks?
- Why sharing functions does not help?
- What was the solution earlier?
REACT.JS WORKSHOP
THANK YOU!
JAIKANT
KUMARAN
@JAIKANTKUMARAN
JAI@TECH47.IN
REACT.JS WORKSHOP
SUMMARY
‣ Hooks are javascript functions.
‣ Hooks help in code reusability.
‣ Hooks help split a component into
smaller functions based on whats
related.
‣ Hooks are easy to share amongst
components or with community.
REACT.JS WORKSHOP
NEXT STEPS
▸ Read about hooks at https://reactjs.org/docs/hooks-
intro.html
▸ Start using hooks in your projects.
REACT.JS WORKSHOP
Lets continue the conversation on the
Slack Channel!
Next Meetup - March 23rd

More Related Content

PPTX
7 Redux challenges
PDF
React hooks Episode #1: An introduction.
PDF
clj and deps.edn
PPTX
PHP Lecture 3 - Functions
PDF
Fernando Daciuk - The magic world of tests with Jest
ODP
Microservices in a netshell
PPTX
JavaScript Metaprogramming with ES 2015 Proxy
PDF
Karate, the black belt of HTTP API testing?
7 Redux challenges
React hooks Episode #1: An introduction.
clj and deps.edn
PHP Lecture 3 - Functions
Fernando Daciuk - The magic world of tests with Jest
Microservices in a netshell
JavaScript Metaprogramming with ES 2015 Proxy
Karate, the black belt of HTTP API testing?

What's hot (8)

PPTX
React js basics
PDF
Introduce Flux & react in practices (KKBOX)
PPTX
React JS part 1
PPT
React js
PDF
Workshop React.js
PPTX
Introduction to react_js
PDF
Getting started with karate dsl
PPTX
Dependency injection
React js basics
Introduce Flux & react in practices (KKBOX)
React JS part 1
React js
Workshop React.js
Introduction to react_js
Getting started with karate dsl
Dependency injection
Ad

Similar to React.js hooks feb 23rd meetup (20)

PPTX
Why Functional Programming So Hard?
PDF
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
PPTX
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
PPTX
Principled And Clean Coding
PPTX
React-JS.pptx
PPTX
ITea&Coffee: React best practices
PPTX
Mcknight well built extensions
PDF
ReactCodemod: An automated approach for refactoring class based components to...
PDF
Journey's diary developing a framework using tdd
PPTX
Understanding react hooks
PPTX
Nodejs from zero to hero
PDF
React Best Practices All Developers Should Follow in 2024.pdf
PDF
Functional programming is the most extreme programming
PDF
Basics of React Hooks.pptx.pdf
PPTX
theory-slides-for react for beginners.pptx
PDF
Clean Code .Net Cheetsheets
PDF
Common design principles and design patterns in automation testing
PPS
Few minutes To better Code - Refactoring
PDF
Troubleshooting tips from docker support engineers
PDF
Workshop - The Little Pattern That Could.pdf
Why Functional Programming So Hard?
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
Principled And Clean Coding
React-JS.pptx
ITea&Coffee: React best practices
Mcknight well built extensions
ReactCodemod: An automated approach for refactoring class based components to...
Journey's diary developing a framework using tdd
Understanding react hooks
Nodejs from zero to hero
React Best Practices All Developers Should Follow in 2024.pdf
Functional programming is the most extreme programming
Basics of React Hooks.pptx.pdf
theory-slides-for react for beginners.pptx
Clean Code .Net Cheetsheets
Common design principles and design patterns in automation testing
Few minutes To better Code - Refactoring
Troubleshooting tips from docker support engineers
Workshop - The Little Pattern That Could.pdf
Ad

Recently uploaded (20)

PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Machine learning based COVID-19 study performance prediction
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPT
Teaching material agriculture food technology
PDF
Approach and Philosophy of On baking technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Cloud computing and distributed systems.
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Encapsulation_ Review paper, used for researhc scholars
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Spectral efficient network and resource selection model in 5G networks
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Network Security Unit 5.pdf for BCA BBA.
Mobile App Security Testing_ A Comprehensive Guide.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Machine learning based COVID-19 study performance prediction
Building Integrated photovoltaic BIPV_UPV.pdf
MYSQL Presentation for SQL database connectivity
Teaching material agriculture food technology
Approach and Philosophy of On baking technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Cloud computing and distributed systems.
Programs and apps: productivity, graphics, security and other tools
MIND Revenue Release Quarter 2 2025 Press Release
Encapsulation_ Review paper, used for researhc scholars

React.js hooks feb 23rd meetup