SlideShare a Scribd company logo
Will React Hooks replace Redux?
Will React Hooks
replace Redux?
Trivikram Kamat
@trivikram @trivikr
#NodeJSInteractive
#react #hooks #redux
What’s my name again?
@trivikram
Tree Weak Rum
Tri vik ram
+ +
. .
What are we going to learn?
• What is React state and why it’s not enough?
• What is Redux and React Hooks?
• Go through a simple ToDo App from Redux
• Replace Redux with React Hooks
@trivikram
What is a Component State?
• State is just data.
• The state for an application might change based on things such
as user actions or a response from an API.
• An application will read the state to determine what sort of User
Interface it should show.
@trivikram
Example (Sched Event schedule app for NJSI)
@trivikram
Waiting for response User data Event data
When React State is not enough?
• When Application is simple, state management is trivial
• As application gets complex, application state spread
across many components
• The functions that update the state also get spread
across many components.
• To have an overview of the application state, you need
to have a mental model of the application structure.
• It becomes harder to trace state changes when
debugging
Source: https://medium.com/dailyjs/f34da253c85f
@trivikram
What is Redux?
• Redux is a very common tool used in React applications for managing
application state
• Predictable: enables writing applications that behave consistently, run in
different environments (client, server, and native), and are easy to test.
• Centralized: enables powerful capabilities like undo/redo, state
persistence, and much more.
• Debuggable: DevTools make it easy to trace when, where, why, and how
your application's state changed
• Flexible: works with any UI layer, and has a large ecosystem of addons to
fit your needs
@trivikram
How Redux simplifies State
Management?
• It allows you to maintain the application state as
a single global store, rather than in local
component state
• Actions: payloads of information that send data
from your application to your store
• Reducers: specify how the application's state
changes in response to actions sent to the store.
• Store:
• holds application state
• allows access to state via getState()
• allows state to be updated via
dispatch(action)
• registers listeners via subscribe(listener)
Source: https://medium.com/dailyjs/f34da253c85f
@trivikram
What are React Hooks?
Hooks let you use state and other React features without
writing a class
• Completely opt-in: You can try Hooks in a few components
without rewriting any existing code.
• 100% backwards-compatible: Hooks don’t contain any
breaking changes.
• Available now: released in React v16.8 in February 2019
@trivikram
Example of React Hooks
@trivikram 12
Button Class: https://codesandbox.io/s/yp3454k81 Button FC: https://codesandbox.io/s/pxkkp9wmx
Are classes being removed from React? 🤔
Nope.
But I wish they did.
@trivikram 13
Do I need to learn React again? 😟
@trivikram 14
Nope.
Hooks provide a more direct API to the React concepts you already
know: props, state, context, refs, and lifecycle.
Let’s learn Hooks by replacing Redux!
Redux ToDo App https://redux.js.org/basics/example
@trivikram 15
Demo
@trivikram 16
Let’s see some code!
Let’s learn Hooks by replacing Redux!
GitHub repo https://github.com/trivikr/react-hooks-todo
@trivikram 17
Create StoreContext
@trivikram 18
Create Store (Higher Order Component)
@trivikram 19
Create Store and StoreContext
@trivikram 20
Replace Redux Provider with Store
@trivikram 21
Replace Redux Provider with Store
@trivikram 22
AddTodo: Remove Redux
@trivikram 23
AddTodo: Remove Redux
@trivikram 24
FilterLink: Remove Redux
@trivikram 25
FilterLink: Remove Redux
@trivikram 26
VisibleTodoList: Remove Redux
@trivikram 27
Demo
@trivikram 28
Let’s run this code!
Should you switch to React Hooks tomorrow morning?
@trivikram 29
Nope.
• Debugging support for Hooks is available in
DevTools, but not as good as that in Redux
• Middleware are not yet available
But developers have welcomed React Hooks (RFC)
Do give them a try in your side projects first!
Will React Hooks replace Redux?
@trivikram 30
It depends.
• React team is recommending libraries to export their own
custom Hooks such as useRedux()
• React Redux since v7.1.0 supports Hooks API and exposes
hooks like useDispatch or useSelector
• React Router supports hooks since v5.1
It’s exciting time in the JavaScript world!
Thank you for listening!
@trivikram 31
Trivikram Kamat
@trivikram
@trivikr
GitHub repo https://github.com/trivikr/react-hooks-todo
Software Development Engineer

More Related Content

What's hot (20)

PDF
GITS Class #20: Building A Fast and Responsive UI in React Native
GITS Indonesia
 
PDF
GITS Class #19: Build Large Scale Vue.js Apps with Vuex
GITS Indonesia
 
PDF
Meetup dpjs react_api
Seydou N Ba
 
PDF
Meteor + React
Taggart Bowen-Gaddy
 
PPTX
App Mod 03: Monoliths to microservices with java ee and spring boot
Judy Breedlove
 
PDF
React & ES6 Intro
Yair Aviner
 
PPTX
an Introduction to Redux
Amin Ashtiani
 
PPTX
Spfx with react redux
Rajesh Kumar
 
PPTX
React redux-redux-saga-rahil-memon
RahilMemon5
 
PDF
Meteor js - TechPeaks Developers Meeting
Francesco Corazza
 
PPTX
Meteor intro-2015
MeteorJS
 
PDF
React js use contexts and useContext hook
Piyush Jamwal
 
PDF
Angular meteor for angular devs
Arc & Codementor
 
PPTX
App Mod 05: App resiliency detecting and preventing issues in distributed apps
Judy Breedlove
 
PPTX
Functional programing jargon
Remo Jansen
 
PDF
Redux Saga - Under the hood
Waqqas Jabbar
 
PPTX
Building high-performance web applications with Preact
Maurice De Beijer [MVP]
 
PPTX
React-JS Component Life-cycle Methods
ANKUSH CHAVAN
 
PPTX
From Streams to Reactive Streams
Oleg Tsal-Tsalko
 
PPT
Corespring
mrinalbagaria
 
GITS Class #20: Building A Fast and Responsive UI in React Native
GITS Indonesia
 
GITS Class #19: Build Large Scale Vue.js Apps with Vuex
GITS Indonesia
 
Meetup dpjs react_api
Seydou N Ba
 
Meteor + React
Taggart Bowen-Gaddy
 
App Mod 03: Monoliths to microservices with java ee and spring boot
Judy Breedlove
 
React & ES6 Intro
Yair Aviner
 
an Introduction to Redux
Amin Ashtiani
 
Spfx with react redux
Rajesh Kumar
 
React redux-redux-saga-rahil-memon
RahilMemon5
 
Meteor js - TechPeaks Developers Meeting
Francesco Corazza
 
Meteor intro-2015
MeteorJS
 
React js use contexts and useContext hook
Piyush Jamwal
 
Angular meteor for angular devs
Arc & Codementor
 
App Mod 05: App resiliency detecting and preventing issues in distributed apps
Judy Breedlove
 
Functional programing jargon
Remo Jansen
 
Redux Saga - Under the hood
Waqqas Jabbar
 
Building high-performance web applications with Preact
Maurice De Beijer [MVP]
 
React-JS Component Life-cycle Methods
ANKUSH CHAVAN
 
From Streams to Reactive Streams
Oleg Tsal-Tsalko
 
Corespring
mrinalbagaria
 

Similar to Will React Hooks replace Redux? (20)

PPTX
React-JS.pptx
AnmolPandita7
 
PDF
Materi Modern React Redux Power Point.pdf
exiabreak
 
PDF
Basics of React Hooks.pptx.pdf
Knoldus Inc.
 
PPTX
STATE MANAGEMENT IN REACT [Autosaved].pptx
siddheshjadhav919123
 
PDF
Understanding react hooks
Samundra khatri
 
PDF
Plain react, hooks and/or Redux ?
Jörn Dinkla
 
PDF
React state management and side-effects – A Review of Hooks
IRJET Journal
 
PDF
Understanding React hooks | Walkingtree Technologies
Walking Tree Technologies
 
PDF
Redux essentials
Chandan Kumar Rana
 
PDF
Let's discover React and Redux with TypeScript
Mathieu Savy
 
PDF
React Interview Question & Answers PDF By ScholarHat
Scholarhat
 
PPTX
React workshop
Imran Sayed
 
PDF
#FrontConf2017 — Enhance your User (and Developer) Experience with React & Redux
phacks
 
PDF
A React Journey
LinkMe Srl
 
PDF
100 React Interview questions 2024.pptx.pdf
codevincent624
 
PDF
Making react part of something greater
Darko Kukovec
 
PDF
Important React Hooks
Knoldus Inc.
 
PDF
React Hooks: Enhancing Functional Components with useState, useEffect, and Cu...
Akshat Pegwar
 
PPTX
React/Redux
Durgesh Vaishnav
 
PPTX
FRONTEND BOOTCAMP 4.pptx
Ehtesham46
 
React-JS.pptx
AnmolPandita7
 
Materi Modern React Redux Power Point.pdf
exiabreak
 
Basics of React Hooks.pptx.pdf
Knoldus Inc.
 
STATE MANAGEMENT IN REACT [Autosaved].pptx
siddheshjadhav919123
 
Understanding react hooks
Samundra khatri
 
Plain react, hooks and/or Redux ?
Jörn Dinkla
 
React state management and side-effects – A Review of Hooks
IRJET Journal
 
Understanding React hooks | Walkingtree Technologies
Walking Tree Technologies
 
Redux essentials
Chandan Kumar Rana
 
Let's discover React and Redux with TypeScript
Mathieu Savy
 
React Interview Question & Answers PDF By ScholarHat
Scholarhat
 
React workshop
Imran Sayed
 
#FrontConf2017 — Enhance your User (and Developer) Experience with React & Redux
phacks
 
A React Journey
LinkMe Srl
 
100 React Interview questions 2024.pptx.pdf
codevincent624
 
Making react part of something greater
Darko Kukovec
 
Important React Hooks
Knoldus Inc.
 
React Hooks: Enhancing Functional Components with useState, useEffect, and Cu...
Akshat Pegwar
 
React/Redux
Durgesh Vaishnav
 
FRONTEND BOOTCAMP 4.pptx
Ehtesham46
 
Ad

Recently uploaded (20)

PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Ad

Will React Hooks replace Redux?

  • 2. Will React Hooks replace Redux? Trivikram Kamat @trivikram @trivikr
  • 4. What’s my name again? @trivikram Tree Weak Rum Tri vik ram + + . .
  • 5. What are we going to learn? • What is React state and why it’s not enough? • What is Redux and React Hooks? • Go through a simple ToDo App from Redux • Replace Redux with React Hooks @trivikram
  • 6. What is a Component State? • State is just data. • The state for an application might change based on things such as user actions or a response from an API. • An application will read the state to determine what sort of User Interface it should show. @trivikram
  • 7. Example (Sched Event schedule app for NJSI) @trivikram Waiting for response User data Event data
  • 8. When React State is not enough? • When Application is simple, state management is trivial • As application gets complex, application state spread across many components • The functions that update the state also get spread across many components. • To have an overview of the application state, you need to have a mental model of the application structure. • It becomes harder to trace state changes when debugging Source: https://medium.com/dailyjs/f34da253c85f @trivikram
  • 9. What is Redux? • Redux is a very common tool used in React applications for managing application state • Predictable: enables writing applications that behave consistently, run in different environments (client, server, and native), and are easy to test. • Centralized: enables powerful capabilities like undo/redo, state persistence, and much more. • Debuggable: DevTools make it easy to trace when, where, why, and how your application's state changed • Flexible: works with any UI layer, and has a large ecosystem of addons to fit your needs @trivikram
  • 10. How Redux simplifies State Management? • It allows you to maintain the application state as a single global store, rather than in local component state • Actions: payloads of information that send data from your application to your store • Reducers: specify how the application's state changes in response to actions sent to the store. • Store: • holds application state • allows access to state via getState() • allows state to be updated via dispatch(action) • registers listeners via subscribe(listener) Source: https://medium.com/dailyjs/f34da253c85f @trivikram
  • 11. What are React Hooks? Hooks let you use state and other React features without writing a class • Completely opt-in: You can try Hooks in a few components without rewriting any existing code. • 100% backwards-compatible: Hooks don’t contain any breaking changes. • Available now: released in React v16.8 in February 2019 @trivikram
  • 12. Example of React Hooks @trivikram 12 Button Class: https://codesandbox.io/s/yp3454k81 Button FC: https://codesandbox.io/s/pxkkp9wmx
  • 13. Are classes being removed from React? 🤔 Nope. But I wish they did. @trivikram 13
  • 14. Do I need to learn React again? 😟 @trivikram 14 Nope. Hooks provide a more direct API to the React concepts you already know: props, state, context, refs, and lifecycle.
  • 15. Let’s learn Hooks by replacing Redux! Redux ToDo App https://redux.js.org/basics/example @trivikram 15
  • 17. Let’s learn Hooks by replacing Redux! GitHub repo https://github.com/trivikr/react-hooks-todo @trivikram 17
  • 19. Create Store (Higher Order Component) @trivikram 19
  • 20. Create Store and StoreContext @trivikram 20
  • 21. Replace Redux Provider with Store @trivikram 21
  • 22. Replace Redux Provider with Store @trivikram 22
  • 29. Should you switch to React Hooks tomorrow morning? @trivikram 29 Nope. • Debugging support for Hooks is available in DevTools, but not as good as that in Redux • Middleware are not yet available But developers have welcomed React Hooks (RFC) Do give them a try in your side projects first!
  • 30. Will React Hooks replace Redux? @trivikram 30 It depends. • React team is recommending libraries to export their own custom Hooks such as useRedux() • React Redux since v7.1.0 supports Hooks API and exposes hooks like useDispatch or useSelector • React Router supports hooks since v5.1 It’s exciting time in the JavaScript world!
  • 31. Thank you for listening! @trivikram 31 Trivikram Kamat @trivikram @trivikr GitHub repo https://github.com/trivikr/react-hooks-todo Software Development Engineer

Editor's Notes

  • #3: Although I’m not actively using React at work now, I’ve been using React since 2016 in many applications and have used both Redux and React Hooks in the past. This talk is slightly old – 10 months old – I’ll point out changes wherever they are
  • #8: Sched doesn’t seem to use React, and have been used just as an example
  • #14: Classes confuse both people and machines Makes code reuse and code organization more difficult You have to understand how this works in JavaScript, which is very different from how it works in most languages You have to remember to bind the event handlers
  • #15: Gradual Adoption Strategy: Just throw the option in the wild and see what happens.
  • #20: useReducer is the first React Hook
  • #24: useContext is another React Hook
  • #31: React is known for building user interfaces, and not state management React Hooks may not replace Redux, but will be adopted widely by other state management solutions