Submit Search
Upload
Workshop State-management in React with Context and Hooks
•
1 like
•
270 views
R
Roy Derks
Follow
Workshop about State-management in React with Context and Hooks
Read less
Read more
Technology
Report
Share
Report
Share
1 of 123
Download now
Download to read offline
Recommended
Handling Large-Scale State-Management with React Context and Hooks
Handling Large-Scale State-Management with React Context and Hooks
Roy Derks
How to use IFTTT by TheQP
How to use IFTTT by TheQP
Rosalie Co
Lfr comp income
Lfr comp income
Nageshwar Reddy
Unit Tests Aren't Enough
Unit Tests Aren't Enough
Trotter Cashion
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
railsconf
Death to Passwords
Death to Passwords
Cristiano Betta
Ultimate Free Digital Marketing Toolkit #EdgeBristol 2012
Ultimate Free Digital Marketing Toolkit #EdgeBristol 2012
Steve Lock
We Are Developers - Modern React (Suspense, Context, Hooks) - Roy Derks
We Are Developers - Modern React (Suspense, Context, Hooks) - Roy Derks
Roy Derks
Recommended
Handling Large-Scale State-Management with React Context and Hooks
Handling Large-Scale State-Management with React Context and Hooks
Roy Derks
How to use IFTTT by TheQP
How to use IFTTT by TheQP
Rosalie Co
Lfr comp income
Lfr comp income
Nageshwar Reddy
Unit Tests Aren't Enough
Unit Tests Aren't Enough
Trotter Cashion
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
railsconf
Death to Passwords
Death to Passwords
Cristiano Betta
Ultimate Free Digital Marketing Toolkit #EdgeBristol 2012
Ultimate Free Digital Marketing Toolkit #EdgeBristol 2012
Steve Lock
We Are Developers - Modern React (Suspense, Context, Hooks) - Roy Derks
We Are Developers - Modern React (Suspense, Context, Hooks) - Roy Derks
Roy Derks
Wrapping and Securing REST APIs with GraphQL
Wrapping and Securing REST APIs with GraphQL
Roy Derks
Composite Applications with WPF and PRISM
Composite Applications with WPF and PRISM
Eyal Vardi
Something old, Something new.pdf
Something old, Something new.pdf
MaiaGrotepass1
Wrapping and securing REST APIs with GraphQL
Wrapping and securing REST APIs with GraphQL
Roy Derks
jQuery For Developers Stack Overflow Dev Days Toronto
jQuery For Developers Stack Overflow Dev Days Toronto
Ralph Whitbeck
WordPress Standardized Loop API
WordPress Standardized Loop API
Chris Jean
Flutter State Management Using GetX.pdf
Flutter State Management Using GetX.pdf
Katy Slemon
Mattia Manzati - Real-World MobX Project Architecture - Codemotion Rome 2019
Mattia Manzati - Real-World MobX Project Architecture - Codemotion Rome 2019
Codemotion
Oleksandr Tolstykh
Oleksandr Tolstykh
CodeFest
Intro to jQuery - LUGOR - Part 1
Intro to jQuery - LUGOR - Part 1
Ralph Whitbeck
Integrating React.js with PHP projects
Integrating React.js with PHP projects
Ignacio Martín
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
ipolevoy
Testing GraphQL in Your JavaScript Application: From Zero to Hundred Percent
Testing GraphQL in Your JavaScript Application: From Zero to Hundred Percent
Roy Derks
Building user interface with react
Building user interface with react
Amit Thakkar
Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)
Gabor Varadi
Frontcon Riga - GraphQL Will Do To REST What JSON Did To XML
Frontcon Riga - GraphQL Will Do To REST What JSON Did To XML
Roy Derks
Strutsjspservlet
Strutsjspservlet
Sagar Nakul
Struts,Jsp,Servlet
Struts,Jsp,Servlet
dasguptahirak
Strutsjspservlet
Strutsjspservlet
Sagar Nakul
Frontin like-a-backer
Frontin like-a-backer
Frank de Jonge
Web Applications of the Future: GraphQL and TypeScript | React Alicante
Web Applications of the Future: GraphQL and TypeScript | React Alicante
Roy Derks
Why GraphQL is Perfect for Node.js Microservices - IJS London 2022
Why GraphQL is Perfect for Node.js Microservices - IJS London 2022
Roy Derks
More Related Content
Similar to Workshop State-management in React with Context and Hooks
Wrapping and Securing REST APIs with GraphQL
Wrapping and Securing REST APIs with GraphQL
Roy Derks
Composite Applications with WPF and PRISM
Composite Applications with WPF and PRISM
Eyal Vardi
Something old, Something new.pdf
Something old, Something new.pdf
MaiaGrotepass1
Wrapping and securing REST APIs with GraphQL
Wrapping and securing REST APIs with GraphQL
Roy Derks
jQuery For Developers Stack Overflow Dev Days Toronto
jQuery For Developers Stack Overflow Dev Days Toronto
Ralph Whitbeck
WordPress Standardized Loop API
WordPress Standardized Loop API
Chris Jean
Flutter State Management Using GetX.pdf
Flutter State Management Using GetX.pdf
Katy Slemon
Mattia Manzati - Real-World MobX Project Architecture - Codemotion Rome 2019
Mattia Manzati - Real-World MobX Project Architecture - Codemotion Rome 2019
Codemotion
Oleksandr Tolstykh
Oleksandr Tolstykh
CodeFest
Intro to jQuery - LUGOR - Part 1
Intro to jQuery - LUGOR - Part 1
Ralph Whitbeck
Integrating React.js with PHP projects
Integrating React.js with PHP projects
Ignacio Martín
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
ipolevoy
Testing GraphQL in Your JavaScript Application: From Zero to Hundred Percent
Testing GraphQL in Your JavaScript Application: From Zero to Hundred Percent
Roy Derks
Building user interface with react
Building user interface with react
Amit Thakkar
Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)
Gabor Varadi
Frontcon Riga - GraphQL Will Do To REST What JSON Did To XML
Frontcon Riga - GraphQL Will Do To REST What JSON Did To XML
Roy Derks
Strutsjspservlet
Strutsjspservlet
Sagar Nakul
Struts,Jsp,Servlet
Struts,Jsp,Servlet
dasguptahirak
Strutsjspservlet
Strutsjspservlet
Sagar Nakul
Frontin like-a-backer
Frontin like-a-backer
Frank de Jonge
Similar to Workshop State-management in React with Context and Hooks
(20)
Wrapping and Securing REST APIs with GraphQL
Wrapping and Securing REST APIs with GraphQL
Composite Applications with WPF and PRISM
Composite Applications with WPF and PRISM
Something old, Something new.pdf
Something old, Something new.pdf
Wrapping and securing REST APIs with GraphQL
Wrapping and securing REST APIs with GraphQL
jQuery For Developers Stack Overflow Dev Days Toronto
jQuery For Developers Stack Overflow Dev Days Toronto
WordPress Standardized Loop API
WordPress Standardized Loop API
Flutter State Management Using GetX.pdf
Flutter State Management Using GetX.pdf
Mattia Manzati - Real-World MobX Project Architecture - Codemotion Rome 2019
Mattia Manzati - Real-World MobX Project Architecture - Codemotion Rome 2019
Oleksandr Tolstykh
Oleksandr Tolstykh
Intro to jQuery - LUGOR - Part 1
Intro to jQuery - LUGOR - Part 1
Integrating React.js with PHP projects
Integrating React.js with PHP projects
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
Testing GraphQL in Your JavaScript Application: From Zero to Hundred Percent
Testing GraphQL in Your JavaScript Application: From Zero to Hundred Percent
Building user interface with react
Building user interface with react
Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)
Frontcon Riga - GraphQL Will Do To REST What JSON Did To XML
Frontcon Riga - GraphQL Will Do To REST What JSON Did To XML
Strutsjspservlet
Strutsjspservlet
Struts,Jsp,Servlet
Struts,Jsp,Servlet
Strutsjspservlet
Strutsjspservlet
Frontin like-a-backer
Frontin like-a-backer
More from Roy Derks
Web Applications of the Future: GraphQL and TypeScript | React Alicante
Web Applications of the Future: GraphQL and TypeScript | React Alicante
Roy Derks
Why GraphQL is Perfect for Node.js Microservices - IJS London 2022
Why GraphQL is Perfect for Node.js Microservices - IJS London 2022
Roy Derks
Why GraphQL Is Perfect For Microservices - CityJS London 2022
Why GraphQL Is Perfect For Microservices - CityJS London 2022
Roy Derks
GraphQL Authentication
GraphQL Authentication
Roy Derks
GraphQL Without a Database | Frontend Developer Love
GraphQL Without a Database | Frontend Developer Love
Roy Derks
Web Applications of the Future with TypeScript and GraphQL
Web Applications of the Future with TypeScript and GraphQL
Roy Derks
Web Applications of the Future with TypeScript and GraphQL
Web Applications of the Future with TypeScript and GraphQL
Roy Derks
Open-sourcing JavaScript at the City of Amsterdam - All Things Open 2019
Open-sourcing JavaScript at the City of Amsterdam - All Things Open 2019
Roy Derks
JNation: REST APIs to GraphQL with Express and Apollo
JNation: REST APIs to GraphQL with Express and Apollo
Roy Derks
Using ReasonML For Your Next JavaScript Project
Using ReasonML For Your Next JavaScript Project
Roy Derks
Boilerplates Are The New Copy-Paste
Boilerplates Are The New Copy-Paste
Roy Derks
GraphQL Will Do To REST What JSON Did To XML
GraphQL Will Do To REST What JSON Did To XML
Roy Derks
Workshop JavaScript ES6+
Workshop JavaScript ES6+
Roy Derks
More from Roy Derks
(13)
Web Applications of the Future: GraphQL and TypeScript | React Alicante
Web Applications of the Future: GraphQL and TypeScript | React Alicante
Why GraphQL is Perfect for Node.js Microservices - IJS London 2022
Why GraphQL is Perfect for Node.js Microservices - IJS London 2022
Why GraphQL Is Perfect For Microservices - CityJS London 2022
Why GraphQL Is Perfect For Microservices - CityJS London 2022
GraphQL Authentication
GraphQL Authentication
GraphQL Without a Database | Frontend Developer Love
GraphQL Without a Database | Frontend Developer Love
Web Applications of the Future with TypeScript and GraphQL
Web Applications of the Future with TypeScript and GraphQL
Web Applications of the Future with TypeScript and GraphQL
Web Applications of the Future with TypeScript and GraphQL
Open-sourcing JavaScript at the City of Amsterdam - All Things Open 2019
Open-sourcing JavaScript at the City of Amsterdam - All Things Open 2019
JNation: REST APIs to GraphQL with Express and Apollo
JNation: REST APIs to GraphQL with Express and Apollo
Using ReasonML For Your Next JavaScript Project
Using ReasonML For Your Next JavaScript Project
Boilerplates Are The New Copy-Paste
Boilerplates Are The New Copy-Paste
GraphQL Will Do To REST What JSON Did To XML
GraphQL Will Do To REST What JSON Did To XML
Workshop JavaScript ES6+
Workshop JavaScript ES6+
Recently uploaded
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Paige Cruz
Working together SRE & Platform Engineering
Working together SRE & Platform Engineering
Marcus Vechiato
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
中 央社
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
FIDO Alliance
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
ScyllaDB
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
Paolo Missier
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
Mark Opanasiuk
AI mind or machine power point presentation
AI mind or machine power point presentation
yogeshlabana357357
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
IES VE
2024 May Patch Tuesday
2024 May Patch Tuesday
Ivanti
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
FIDO Alliance
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
alexjohnson7307
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
DianaGray10
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
FIDO Alliance
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
FIDO Alliance
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
Memoori
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
FIDO Alliance
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
FIDO Alliance
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
Patrick Viafore
Recently uploaded
(20)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Working together SRE & Platform Engineering
Working together SRE & Platform Engineering
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
AI mind or machine power point presentation
AI mind or machine power point presentation
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
2024 May Patch Tuesday
2024 May Patch Tuesday
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
Workshop State-management in React with Context and Hooks
1.
State-Management in React with
Context and Hooks JSWorld Workshop 2021 @gethackteam
2.
What is this
about? @gethackteam
3.
4.
Who Am I? @gethackteam
5.
Roy Derks @gethackteam
6.
Roy Derks @gethackteam Books: Search:
Roy Derks +25
7.
newline.co/fullstack-graphql
8.
Let’s look at
“state” @gethackteam
9.
State <Menu /> <MenuItem /> @gethackteam
10.
State @gethackteam open = false
open = true
11.
State @gethackteam Pass state down? UPDATE FUNCTION STATE PROPS
12.
State <MenuItem /> <Menu /> <SubMenu
/> @gethackteam
13.
State @gethackteam open = false
open = true
14.
State @gethackteam open = false openChild
= [1] open = true
15.
And what about
accessible components? @gethackteam
16.
State @gethackteam open = false openChild
= [1] open = true
17.
State @gethackteam open = false openChild
= [1] open = true selectedChild = 1
18.
Would you still
pass the props down? @gethackteam
19.
<MenuItem /> <Menu /> <SubMenu
/> State <Menu /> <MenuItem /> @gethackteam
20.
<MenuItem /> <Menu /> <SubMenu
/> State <Menu /> <MenuItem /> @gethackteam
21.
State <App /> <Component /> <Component
/> <App /> <Page /> @gethackteam
22.
State
23.
State
24.
State
25.
State @gethackteam STATE UPDATE FUNTION MobX
26.
What about the
Context API? @gethackteam
27.
About the Context
API BEFORE React v16.3 @gethackteam
28.
How does it
work? @gethackteam
29.
How does it
work? CONTEXT UPDATE CONTEXT @gethackteam
30.
How does it
work? @gethackteam
31.
How does it
work? Create the Context “store” @gethackteam
32.
How does it
work? @gethackteam
33.
How does it
work? Set the Context value @gethackteam
34.
How does it
work? @gethackteam
35.
How does it
work? Consume the values inside the Context @gethackteam
36.
Looks familiar 🤔 @gethackteam
37.
Looks familiar @gethackteam
38.
Looks familiar @gethackteam
39.
Looks familiar @gethackteam
40.
Looks familiar @gethackteam
41.
Cool! How can
I implement this? @gethackteam
42.
How to implement?
43.
How to implement?
44.
How to implement?
45.
How to implement?
46.
Or with Hooks! @gethackteam
47.
How to implement? @gethackteam
48.
How to implement? @gethackteam
49.
How to implement? @gethackteam
50.
Let’s compare @gethackteam
51.
@gethackteam
52.
Update the Context @gethackteam
53.
Update the Context @gethackteam
54.
Update the Context What
is this value? @gethackteam
55.
Update the Context
56.
Update the Context
57.
Update the Context
58.
Update the Context
59.
Separating Providers from Consumers @gethackteam
60.
Separating Providers @gethackteam
61.
Separating Providers @gethackteam
62.
Separating Providers @gethackteam
63.
Separating Providers @gethackteam
64.
@gethackteam Separating Providers
65.
@gethackteam Separating Providers
66.
@gethackteam Separating Providers
67.
And create your
own Hook to handle this @gethackteam
68.
@gethackteam Create Custom Hook
69.
@gethackteam Create Custom Hook
70.
@gethackteam Create Custom Hook
71.
When using Context you
*could* useMemo() @gethackteam
72.
useMemo() @gethackteam CONTEXT UPDATE ACTION
73.
useMemo() @gethackteam CONTEXT UPDATE ACTION
74.
useMemo() @gethackteam CONTEXT UPDATE ACTION
75.
useMemo() @gethackteam
76.
useMemo() @gethackteam
77.
What if I
have more complex logic? @gethackteam
78.
useReducer() @gethackteam
79.
useReducer() Current state @gethackteam
80.
useReducer() Current state Initial
state @gethackteam
81.
useReducer() Current state Initial
state Function to update state @gethackteam
82.
useReducer() Current state Initial
state Function to update state Returns new state @gethackteam
83.
useReducer() @gethackteam
84.
useReducer() @gethackteam
85.
useReducer() @gethackteam
86.
useReducer() @gethackteam
87.
useReducer() @gethackteam
88.
useReducer() @gethackteam
89.
useReducer() @gethackteam
90.
useReducer() @gethackteam
91.
useReducer() @gethackteam
92.
useReducer() @gethackteam
93.
useReducer() @gethackteam
94.
useReducer() @gethackteam
95.
Again, looks familiar right?
🤔 @gethackteam
96.
useReducer() @gethackteam
97.
useReducer() @gethackteam
98.
useReducer() @gethackteam
99.
Use it with
Context @gethackteam
100.
Update the Context @gethackteam
101.
Update the Context @gethackteam
102.
Update the Context @gethackteam
103.
Update the Context @gethackteam
104.
What about debugging? @gethackteam
105.
@gethackteam Update the Context
106.
@gethackteam Update the Context
107.
@gethackteam Update the Context
108.
@gethackteam Update the Context
109.
What if i
want a “global” context? @gethackteam
110.
Nest Context Providers @gethackteam
111.
Nest Context Providers @gethackteam
112.
Nest Context Providers @gethackteam
113.
Nest Context Providers @gethackteam
114.
Nest Context Providers @gethackteam
115.
Nest Context Providers @gethackteam
116.
Nest Context Providers @gethackteam
117.
Nest Context Providers @gethackteam
118.
Nest Context Providers @gethackteam
119.
To summarise… @gethackteam
120.
Context lets you
pass data through the component tree @gethackteam
121.
Hooks let you use
easily access this Context @gethackteam
122.
Context is NOT
a solution for every state problem @gethackteam
123.
Want to learn
more? #javascriptEverywhere @gethackteam Get the code
Download now