SlideShare a Scribd company logo
1 of 22
Download to read offline
Using Redux
Maximising development efficiency
Static
websites
Singe Page
Applications
complexity
Refresh
page
LiveReload
CSS
time
HMR
(Hot Module Reload)
JS
(stateless
components)
HMR
JS
(everything)
Redux
Why Redux is natural
Demo: Redux in use
criticalcss.com
Performance, tooling, React
Penthouse - critical css generator
About me
@pocketjoso pocketjoso
Jonas Ohlsson - front end developer
https://jonassebastianohlsson.com
• Redux - overview
• criticalcss.com redux usage in practice
This talk
• Predictable State container (evolution of Flux)
• One single immutable State
• Reducers instead of Stores
• Hot Module Reloading and Time travel
• Modular, tiny (2kb!)
• Follows Best practice
What is Redux
Redux vs traditional Flux
Action Reducer
(Redux)
Store ViewRedux
Flux
Data flow
Today’s example
• Dispatch action for new generate job
• Update State via reducer
• Receive State in Component
Action creatorAction Reducer Store View
• Returns actions; does not dispatch them
• Write reducers instead of Stores
• Pure functions
• (state, action) => newState
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce
Reducers
ReducerAction Reducer Store View
Redux StoreAction Reducer Store View
Provider Connect
ViewAction Reducer Store
Redux using react-redux
Data flow with react-redux
(Store) Provider
• Wraps whole App
Provider
• Makes Store available to components
Store
ConnectConnect
• Injects props, subscribes to Store
• Keeps components Dumb
View
ConnectConnect View
• won’t work - actionCreator does not dispatch action
ConnectConnect View
• Connect auto-injects dispatch to props
Connect
• 2nd param creates self-dispatching action functions
Connect View
• write Reducers instead of Stores
• keep Components dumb using Connect
• benefit from:
• Hot Module Reloading
• Powerful DevTools
• Components easier to understand and test
Summary
That’s all!
Recommended packages
• Redux - https://github.com/rackt/redux
• React transform boilerplate (for Hot Module Reloading) - https://github.com/gaearon/react-
transform-boilerplate
• Redux DevTools - https://github.com/gaearon/redux-devtools
Redux resources
• Redux release and intro to Time travel - https://www.youtube.com/watch?v=xsSnOQynTHs
• Best starting point for understanding redux - Free video tutorial on Redux by Dan Abramov
(creator) - https://egghead.io/lessons/javascript-redux-the-single-immutable-state-tree
• Written notes for above video tutorial - https://gist.github.com/diegoconcha/
8918294bb9df69876b22
• Official docs (great) - http://rackt.org/redux/index.html
• Redux slim in a gist - https://gist.github.com/gaearon/ffd88b0e4f00b22c3159
Resources
Redux related resources
• Full stack Redux tutorial - http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial.html
• Redux for state management - http://konkle.us/state-management-with-redux/
• Full stack Redux boilerplate - https://github.com/erikras/react-redux-universal-hot-example
• Support for Functional Components in React Transform -https://github.com/gaearon/babel-plugin-
react-transform/issues/57
• Beyond just Redux for async actions - riadbenguella.com/from-actions-creators-to-sagas-redux-
upgraded
Other related resources
• Webpack (react docs) - https://christianalfoni.github.io/react-webpack-cookbook/index.html
• Functional Stateless Components - http://tylermcginnis.com/functional-components-vs-stateless-
functional-components-vs-stateless-components/
• https://medium.com/@esamatti/react-js-pure-render-performance-anti-pattern-fb88c101332f
Resources

More Related Content

What's hot

React.js and Redux overview
React.js and Redux overviewReact.js and Redux overview
React.js and Redux overviewAlex Bachuk
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥Remo Jansen
 
Let's discover React and Redux with TypeScript
Let's discover React and Redux with TypeScriptLet's discover React and Redux with TypeScript
Let's discover React and Redux with TypeScriptMathieu Savy
 
Building React Applications with Redux
Building React Applications with ReduxBuilding React Applications with Redux
Building React Applications with ReduxFITC
 
Academy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & ToolingAcademy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & ToolingBinary Studio
 
A Brief Introduction to React.js
A Brief Introduction to React.jsA Brief Introduction to React.js
A Brief Introduction to React.jsDoug Neiner
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with ReduxVedran Blaženka
 
JS Chicago Meetup 2/23/16 - Redux & Routes
JS Chicago Meetup 2/23/16 - Redux & RoutesJS Chicago Meetup 2/23/16 - Redux & Routes
JS Chicago Meetup 2/23/16 - Redux & RoutesNick Dreckshage
 
React state management with Redux and MobX
React state management with Redux and MobXReact state management with Redux and MobX
React state management with Redux and MobXDarko Kukovec
 
React.js in real world apps.
React.js in real world apps. React.js in real world apps.
React.js in real world apps. Emanuele DelBono
 
Better web apps with React and Redux
Better web apps with React and ReduxBetter web apps with React and Redux
Better web apps with React and ReduxAli Sa'o
 
React for Dummies
React for DummiesReact for Dummies
React for DummiesMitch Chen
 
Redux training
Redux trainingRedux training
Redux trainingdasersoft
 

What's hot (20)

React.js and Redux overview
React.js and Redux overviewReact.js and Redux overview
React.js and Redux overview
 
How to Redux
How to ReduxHow to Redux
How to Redux
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥
 
React & Redux
React & ReduxReact & Redux
React & Redux
 
Let's discover React and Redux with TypeScript
Let's discover React and Redux with TypeScriptLet's discover React and Redux with TypeScript
Let's discover React and Redux with TypeScript
 
Building React Applications with Redux
Building React Applications with ReduxBuilding React Applications with Redux
Building React Applications with Redux
 
Academy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & ToolingAcademy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & Tooling
 
A Brief Introduction to React.js
A Brief Introduction to React.jsA Brief Introduction to React.js
A Brief Introduction to React.js
 
React / Redux Architectures
React / Redux ArchitecturesReact / Redux Architectures
React / Redux Architectures
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with Redux
 
JS Chicago Meetup 2/23/16 - Redux & Routes
JS Chicago Meetup 2/23/16 - Redux & RoutesJS Chicago Meetup 2/23/16 - Redux & Routes
JS Chicago Meetup 2/23/16 - Redux & Routes
 
React js
React jsReact js
React js
 
React state management with Redux and MobX
React state management with Redux and MobXReact state management with Redux and MobX
React state management with Redux and MobX
 
Angular redux
Angular reduxAngular redux
Angular redux
 
React.js in real world apps.
React.js in real world apps. React.js in real world apps.
React.js in real world apps.
 
Better web apps with React and Redux
Better web apps with React and ReduxBetter web apps with React and Redux
Better web apps with React and Redux
 
React and redux
React and reduxReact and redux
React and redux
 
React & redux
React & reduxReact & redux
React & redux
 
React for Dummies
React for DummiesReact for Dummies
React for Dummies
 
Redux training
Redux trainingRedux training
Redux training
 

Viewers also liked

Automating Faster Page Rendering - step by step from start to finish
Automating Faster Page Rendering - step by step from start to finishAutomating Faster Page Rendering - step by step from start to finish
Automating Faster Page Rendering - step by step from start to finishJonas Ohlsson Aden
 
`redux`と`flux`を比べてみたときの個人的な感想
`redux`と`flux`を比べてみたときの個人的な感想`redux`と`flux`を比べてみたときの個人的な感想
`redux`と`flux`を比べてみたときの個人的な感想佐藤 俊太郎
 
Retail Loyalty Congress 2016 // Masterclass IceMobile
Retail Loyalty Congress 2016 // Masterclass IceMobile Retail Loyalty Congress 2016 // Masterclass IceMobile
Retail Loyalty Congress 2016 // Masterclass IceMobile Anna Witteman
 
для клиентов франчайзинг
для клиентов франчайзингдля клиентов франчайзинг
для клиентов франчайзингMarina Kirilyuk
 
What’s next for the next generation of Recruiter? | Talent Connect 2016
What’s next for the next generation of Recruiter? | Talent Connect 2016What’s next for the next generation of Recruiter? | Talent Connect 2016
What’s next for the next generation of Recruiter? | Talent Connect 2016LinkedIn Talent Solutions
 
Ready4S portfolio
Ready4S portfolioReady4S portfolio
Ready4S portfolioReady4S
 
Akamai State of the Internet Q4 2008
Akamai State of the Internet Q4 2008Akamai State of the Internet Q4 2008
Akamai State of the Internet Q4 2008Amit Ranjan
 
Careering: Reflexivity, play and a life in the media - Pat Kane
Careering: Reflexivity, play and a life in the media - Pat KaneCareering: Reflexivity, play and a life in the media - Pat Kane
Careering: Reflexivity, play and a life in the media - Pat Kanewww.patkane.global
 
10 Monsters from a Content Marketer’s Nightmare: A Halloween SlideSCARE
10 Monsters from a Content Marketer’s Nightmare: A Halloween SlideSCARE10 Monsters from a Content Marketer’s Nightmare: A Halloween SlideSCARE
10 Monsters from a Content Marketer’s Nightmare: A Halloween SlideSCAREUberflip
 
Kk dengan jamban yang sehat dari 5 kota
Kk dengan jamban yang sehat dari 5 kotaKk dengan jamban yang sehat dari 5 kota
Kk dengan jamban yang sehat dari 5 kotawely supriatna
 
Raspberry pi 用アクセサリ
Raspberry pi 用アクセサリRaspberry pi 用アクセサリ
Raspberry pi 用アクセサリTsuyoshi Horigome
 
Design Matters: Industrial Design & Product Styling in Wearable Tech
Design Matters: Industrial Design & Product Styling in Wearable TechDesign Matters: Industrial Design & Product Styling in Wearable Tech
Design Matters: Industrial Design & Product Styling in Wearable TechChristopher Grayson
 
Leveraging Social Media Optimization for Online Marketing
Leveraging Social Media Optimization for Online MarketingLeveraging Social Media Optimization for Online Marketing
Leveraging Social Media Optimization for Online MarketingTom Walls
 
Wicked ambiguity-content-strategy-140518173929-phpapp02
Wicked ambiguity-content-strategy-140518173929-phpapp02Wicked ambiguity-content-strategy-140518173929-phpapp02
Wicked ambiguity-content-strategy-140518173929-phpapp02Vera Kovaleva
 
Working While Pregnant: 7 Most Pressing Questions Answered
Working While Pregnant: 7 Most Pressing Questions AnsweredWorking While Pregnant: 7 Most Pressing Questions Answered
Working While Pregnant: 7 Most Pressing Questions Answeredlawsuitlegal
 

Viewers also liked (20)

Killer page load performance
Killer page load performanceKiller page load performance
Killer page load performance
 
Automating Faster Page Rendering - step by step from start to finish
Automating Faster Page Rendering - step by step from start to finishAutomating Faster Page Rendering - step by step from start to finish
Automating Faster Page Rendering - step by step from start to finish
 
Isomorphic react in real life
Isomorphic react in real lifeIsomorphic react in real life
Isomorphic react in real life
 
Reduxについて
ReduxについてReduxについて
Reduxについて
 
`redux`と`flux`を比べてみたときの個人的な感想
`redux`と`flux`を比べてみたときの個人的な感想`redux`と`flux`を比べてみたときの個人的な感想
`redux`と`flux`を比べてみたときの個人的な感想
 
Let's Redux!
Let's Redux!Let's Redux!
Let's Redux!
 
Natural beauty
Natural beautyNatural beauty
Natural beauty
 
Retail Loyalty Congress 2016 // Masterclass IceMobile
Retail Loyalty Congress 2016 // Masterclass IceMobile Retail Loyalty Congress 2016 // Masterclass IceMobile
Retail Loyalty Congress 2016 // Masterclass IceMobile
 
для клиентов франчайзинг
для клиентов франчайзингдля клиентов франчайзинг
для клиентов франчайзинг
 
What’s next for the next generation of Recruiter? | Talent Connect 2016
What’s next for the next generation of Recruiter? | Talent Connect 2016What’s next for the next generation of Recruiter? | Talent Connect 2016
What’s next for the next generation of Recruiter? | Talent Connect 2016
 
Ready4S portfolio
Ready4S portfolioReady4S portfolio
Ready4S portfolio
 
Akamai State of the Internet Q4 2008
Akamai State of the Internet Q4 2008Akamai State of the Internet Q4 2008
Akamai State of the Internet Q4 2008
 
Careering: Reflexivity, play and a life in the media - Pat Kane
Careering: Reflexivity, play and a life in the media - Pat KaneCareering: Reflexivity, play and a life in the media - Pat Kane
Careering: Reflexivity, play and a life in the media - Pat Kane
 
10 Monsters from a Content Marketer’s Nightmare: A Halloween SlideSCARE
10 Monsters from a Content Marketer’s Nightmare: A Halloween SlideSCARE10 Monsters from a Content Marketer’s Nightmare: A Halloween SlideSCARE
10 Monsters from a Content Marketer’s Nightmare: A Halloween SlideSCARE
 
Kk dengan jamban yang sehat dari 5 kota
Kk dengan jamban yang sehat dari 5 kotaKk dengan jamban yang sehat dari 5 kota
Kk dengan jamban yang sehat dari 5 kota
 
Raspberry pi 用アクセサリ
Raspberry pi 用アクセサリRaspberry pi 用アクセサリ
Raspberry pi 用アクセサリ
 
Design Matters: Industrial Design & Product Styling in Wearable Tech
Design Matters: Industrial Design & Product Styling in Wearable TechDesign Matters: Industrial Design & Product Styling in Wearable Tech
Design Matters: Industrial Design & Product Styling in Wearable Tech
 
Leveraging Social Media Optimization for Online Marketing
Leveraging Social Media Optimization for Online MarketingLeveraging Social Media Optimization for Online Marketing
Leveraging Social Media Optimization for Online Marketing
 
Wicked ambiguity-content-strategy-140518173929-phpapp02
Wicked ambiguity-content-strategy-140518173929-phpapp02Wicked ambiguity-content-strategy-140518173929-phpapp02
Wicked ambiguity-content-strategy-140518173929-phpapp02
 
Working While Pregnant: 7 Most Pressing Questions Answered
Working While Pregnant: 7 Most Pressing Questions AnsweredWorking While Pregnant: 7 Most Pressing Questions Answered
Working While Pregnant: 7 Most Pressing Questions Answered
 

Similar to Using redux

Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)Zach Lendon
 
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer ReplacementMidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer ReplacementZach Lendon
 
Understanding Facebook's React.js
Understanding Facebook's React.jsUnderstanding Facebook's React.js
Understanding Facebook's React.jsFederico Torre
 
ReactJS vs AngularJS - Head to Head comparison
ReactJS vs AngularJS - Head to Head comparisonReactJS vs AngularJS - Head to Head comparison
ReactJS vs AngularJS - Head to Head comparison500Tech
 
Introduce Flux & react in practices (KKBOX)
Introduce Flux & react in practices (KKBOX)Introduce Flux & react in practices (KKBOX)
Introduce Flux & react in practices (KKBOX)Hsuan Fu Lien
 
Making react part of something greater
Making react part of something greaterMaking react part of something greater
Making react part of something greaterDarko Kukovec
 
Introduce flux & react in practice
Introduce flux & react in practiceIntroduce flux & react in practice
Introduce flux & react in practiceHsuan Fu Lien
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today Nitin Tyagi
 
An Overview of the React Ecosystem
An Overview of the React EcosystemAn Overview of the React Ecosystem
An Overview of the React EcosystemFITC
 
Introduction to GitHub Actions - How to easily automate and integrate with Gi...
Introduction to GitHub Actions - How to easily automate and integrate with Gi...Introduction to GitHub Actions - How to easily automate and integrate with Gi...
Introduction to GitHub Actions - How to easily automate and integrate with Gi...All Things Open
 
One code Web, iOS, Android
One code Web, iOS, AndroidOne code Web, iOS, Android
One code Web, iOS, AndroidArtem Marchenko
 
A React Journey
A React JourneyA React Journey
A React JourneyLinkMe Srl
 
Building a website without a webserver on Azure
Building a website without a webserver on AzureBuilding a website without a webserver on Azure
Building a website without a webserver on AzureTodd Whitehead
 
React gsg presentation with ryan jung & elias malik
React   gsg presentation with ryan jung & elias malikReact   gsg presentation with ryan jung & elias malik
React gsg presentation with ryan jung & elias malikLama K Banna
 
Using redux and angular 2 with meteor
Using redux and angular 2 with meteorUsing redux and angular 2 with meteor
Using redux and angular 2 with meteorKen Ono
 
Using redux and angular 2 with meteor
Using redux and angular 2 with meteorUsing redux and angular 2 with meteor
Using redux and angular 2 with meteorKen Ono
 

Similar to Using redux (20)

Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
 
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer ReplacementMidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
 
Redux Tech Talk
Redux Tech TalkRedux Tech Talk
Redux Tech Talk
 
Advanced React
Advanced ReactAdvanced React
Advanced React
 
Understanding Facebook's React.js
Understanding Facebook's React.jsUnderstanding Facebook's React.js
Understanding Facebook's React.js
 
ReactJS vs AngularJS - Head to Head comparison
ReactJS vs AngularJS - Head to Head comparisonReactJS vs AngularJS - Head to Head comparison
ReactJS vs AngularJS - Head to Head comparison
 
React js
React jsReact js
React js
 
Introduce Flux & react in practices (KKBOX)
Introduce Flux & react in practices (KKBOX)Introduce Flux & react in practices (KKBOX)
Introduce Flux & react in practices (KKBOX)
 
Making react part of something greater
Making react part of something greaterMaking react part of something greater
Making react part of something greater
 
Introduce flux & react in practice
Introduce flux & react in practiceIntroduce flux & react in practice
Introduce flux & react in practice
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
 
An Overview of the React Ecosystem
An Overview of the React EcosystemAn Overview of the React Ecosystem
An Overview of the React Ecosystem
 
Introduction to GitHub Actions - How to easily automate and integrate with Gi...
Introduction to GitHub Actions - How to easily automate and integrate with Gi...Introduction to GitHub Actions - How to easily automate and integrate with Gi...
Introduction to GitHub Actions - How to easily automate and integrate with Gi...
 
One code Web, iOS, Android
One code Web, iOS, AndroidOne code Web, iOS, Android
One code Web, iOS, Android
 
React.js at Cortex
React.js at CortexReact.js at Cortex
React.js at Cortex
 
A React Journey
A React JourneyA React Journey
A React Journey
 
Building a website without a webserver on Azure
Building a website without a webserver on AzureBuilding a website without a webserver on Azure
Building a website without a webserver on Azure
 
React gsg presentation with ryan jung & elias malik
React   gsg presentation with ryan jung & elias malikReact   gsg presentation with ryan jung & elias malik
React gsg presentation with ryan jung & elias malik
 
Using redux and angular 2 with meteor
Using redux and angular 2 with meteorUsing redux and angular 2 with meteor
Using redux and angular 2 with meteor
 
Using redux and angular 2 with meteor
Using redux and angular 2 with meteorUsing redux and angular 2 with meteor
Using redux and angular 2 with meteor
 

Recently uploaded

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 

Recently uploaded (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 

Using redux

  • 2. Static websites Singe Page Applications complexity Refresh page LiveReload CSS time HMR (Hot Module Reload) JS (stateless components) HMR JS (everything) Redux Why Redux is natural
  • 3. Demo: Redux in use criticalcss.com
  • 4. Performance, tooling, React Penthouse - critical css generator About me @pocketjoso pocketjoso Jonas Ohlsson - front end developer https://jonassebastianohlsson.com
  • 5. • Redux - overview • criticalcss.com redux usage in practice This talk
  • 6. • Predictable State container (evolution of Flux) • One single immutable State • Reducers instead of Stores • Hot Module Reloading and Time travel • Modular, tiny (2kb!) • Follows Best practice What is Redux
  • 7. Redux vs traditional Flux Action Reducer (Redux) Store ViewRedux Flux Data flow
  • 8. Today’s example • Dispatch action for new generate job • Update State via reducer • Receive State in Component
  • 9. Action creatorAction Reducer Store View • Returns actions; does not dispatch them
  • 10. • Write reducers instead of Stores • Pure functions • (state, action) => newState https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce Reducers
  • 13. Provider Connect ViewAction Reducer Store Redux using react-redux Data flow with react-redux
  • 14. (Store) Provider • Wraps whole App Provider • Makes Store available to components Store
  • 15. ConnectConnect • Injects props, subscribes to Store • Keeps components Dumb View
  • 16. ConnectConnect View • won’t work - actionCreator does not dispatch action
  • 17. ConnectConnect View • Connect auto-injects dispatch to props
  • 18. Connect • 2nd param creates self-dispatching action functions Connect View
  • 19. • write Reducers instead of Stores • keep Components dumb using Connect • benefit from: • Hot Module Reloading • Powerful DevTools • Components easier to understand and test Summary
  • 21. Recommended packages • Redux - https://github.com/rackt/redux • React transform boilerplate (for Hot Module Reloading) - https://github.com/gaearon/react- transform-boilerplate • Redux DevTools - https://github.com/gaearon/redux-devtools Redux resources • Redux release and intro to Time travel - https://www.youtube.com/watch?v=xsSnOQynTHs • Best starting point for understanding redux - Free video tutorial on Redux by Dan Abramov (creator) - https://egghead.io/lessons/javascript-redux-the-single-immutable-state-tree • Written notes for above video tutorial - https://gist.github.com/diegoconcha/ 8918294bb9df69876b22 • Official docs (great) - http://rackt.org/redux/index.html • Redux slim in a gist - https://gist.github.com/gaearon/ffd88b0e4f00b22c3159 Resources
  • 22. Redux related resources • Full stack Redux tutorial - http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial.html • Redux for state management - http://konkle.us/state-management-with-redux/ • Full stack Redux boilerplate - https://github.com/erikras/react-redux-universal-hot-example • Support for Functional Components in React Transform -https://github.com/gaearon/babel-plugin- react-transform/issues/57 • Beyond just Redux for async actions - riadbenguella.com/from-actions-creators-to-sagas-redux- upgraded Other related resources • Webpack (react docs) - https://christianalfoni.github.io/react-webpack-cookbook/index.html • Functional Stateless Components - http://tylermcginnis.com/functional-components-vs-stateless- functional-components-vs-stateless-components/ • https://medium.com/@esamatti/react-js-pure-render-performance-anti-pattern-fb88c101332f Resources