SlideShare a Scribd company logo
SIX MONTHS OF REACT & REDUX:
A REAL WORLD USE CASE
Thom Nichols - @thom_nic
DISCLAIMER:
 Not an expert
 I might be doing it wrong
SO YOU WANT TO TRY REACT +
REDUX…
WHAT ARE YOU (PROBABLY) GOING TO
NEED?
 Webpack
 Babel + presets
 React-redux
 Redux-thunk
 Redux-logger
 Axios or fetch-polyfill
 Immutable.js
 React
 Redux
 Jest or Mocha + JSDOM or Karma + Phantomjs
 React-router
 React-router-redux
ALL YOU NEED IS A FEW PACKAGES
FROM NPM
GREAT! AM I READY TO START
PROGRAMMING NOW?
WHAT ARE YOU (PROBABLY) GOING TO
NEED?
 Webpack
 Babel + presets
 React-redux
 Redux-thunk
 Redux-logger
 Axios or fetch-polyfill
 Immutable.js
 React
 Redux
 Jest or Mocha + JSDOM or Karma + Phantomjs
 React-router
 React-router-redux
What we actually
care about
WHAT ARE YOU (PROBABLY) GOING TO
NEED?
 Webpack
 Babel + presets
 React-redux
 Redux-thunk
 Redux-logger
 Axios or fetch-polyfill
 Immutable.js
 React
 Redux
 Jest or Mocha + JSDOM or Karma + Phantomjs
 React-router
 React-router-redux
What we actually
care about
LET’S TALK ABOUT REDUX
FLUX ARCHITECTURE
FLUX ARCHITECTURE - SIMPLIFIED
SHOW ME THE CODE!
TRIVIAL ACTION EXAMPLE
store.dispatch( addTodo(‘call mom’) );
TRIVIAL REDUCER EXAMPLE
THINGS NOBODY TOLD ME ABOUT
REACT + REDUX
USE IMMUTABLE.JS RECORDS!
 Without Records:
 With Records:
USE IMMUTABLE.JS RECORDS!
WHAT SHOULD MY STORES HOLD?
WHAT DOES MY DATA LOOK LIKE?
MY STORES HOLD MAPS
STORES MAY LISTEN TO “OTHER”
ACTIONS
I’M IN UR COMPONENT…
CONNECTIN UR PROPS
ACTIONS + PROMISE CHAINING =
AWESOME
ACTIONS + PROMISE CHAINING =
AWESOME
WHAT’S ANNOYING?
 Component testing connected components is hard.
I rely (mostly) on functional testing
 Export both a connect()-ed and non-connected component
 See: Erik Ras’ “ducks”
WHAT’S ANNOYING?
 It’s difficult to call a method on a component wrapped as a high-order
component…
DON’T DO IT
 BUT: you probably shouldn’t be doing that anyway:
 pass data via callbacks passed from parent component.
 Or pass data via a redux action
LET’S RECAP
 Use ImmutableJS records for domain types in stores
 Use ImmutableJS Maps often for store data containers
 Use redux-thunk to make remote requests in actions
 Async action creators should always return a promise
 Reducer cases are not always 1-to-1 with actions
 Let me know if you’ve figured out the component testing issue with
connected components…
 HoC component wrapping cause some pain
 Webpack is really the most annoying part
MORE TRICKS
DEBOUNCE EXPENSIVE ACTIONS
 Some independent top-level components say what data they want to
fetch from `componentWillMount()`
 Debounce  a single remote request
CONSISTENTLY DISPATCH START & END
ACTIONS
 These are used for loading indicator & error messaging
BONUS: REDUX-FORM IS AWESOME
BONUS: REDUX-FORM IS AWESOME
DECIDE WHAT WORKS FOR YOU
Frameworks are less about prescribing “the
right way” and more about getting everyone
to do things the same way.
- @thom_nic
THANKS
ACTUALLY….
ASK ME ABOUT DIGITAL ELECTRICITY
MORE SLIDES
I DON’T NEED ANGULAR-RESOURCE
 This is actually (really) boilerplate. Replaced with this:
WHY I DON’T NEED ANGULAR-
RESOURCE
 … and http thunks of thunks:
A WORD TO THE WISE…
 Avoid temptation to do client-side data manipulation to attempt to
mirror server state.
 Better to always fetch from the server as the source of truth

More Related Content

What's hot

React & Redux
React & ReduxReact & Redux
React & Redux
Federico Bond
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with Redux
Vedran Blaženka
 
Getting started with Redux js
Getting started with Redux jsGetting started with Redux js
Getting started with Redux js
Citrix
 
React.js and Redux overview
React.js and Redux overviewReact.js and Redux overview
React.js and Redux overview
Alex Bachuk
 
Academy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & ToolingAcademy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & Tooling
Binary Studio
 
Introduction to Redux
Introduction to ReduxIntroduction to Redux
Introduction to Redux
Ignacio Martín
 
React, Flux and a little bit of Redux
React, Flux and a little bit of ReduxReact, Flux and a little bit of Redux
React, Flux and a little bit of Redux
Ny Fanilo Andrianjafy, B.Eng.
 
Using redux
Using reduxUsing redux
Using redux
Jonas Ohlsson Aden
 
React / Redux Architectures
React / Redux ArchitecturesReact / Redux Architectures
React / Redux Architectures
Vinícius Ribeiro
 
Introduction to React & Redux
Introduction to React & ReduxIntroduction to React & Redux
Introduction to React & Redux
Boris Dinkevich
 
Redux training
Redux trainingRedux training
Redux training
dasersoft
 
React, Redux, ES2015 by Max Petruck
React, Redux, ES2015   by Max PetruckReact, Redux, ES2015   by Max Petruck
React, Redux, ES2015 by Max Petruck
Maksym Petruk
 
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
Ali Sa'o
 
React & redux
React & reduxReact & redux
React & redux
Cédric Hartland
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
Nikolaus Graf
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥
Remo Jansen
 
React JS and Redux
React JS and ReduxReact JS and Redux
React JS and Redux
Glib Kechyn
 
Switch to React.js from AngularJS developer
Switch to React.js from AngularJS developerSwitch to React.js from AngularJS developer
Switch to React.js from AngularJS developer
Eugene Zharkov
 
React Lifecycle and Reconciliation
React Lifecycle and ReconciliationReact Lifecycle and Reconciliation
React Lifecycle and Reconciliation
Zhihao Li
 
An Introduction to ReactJS
An Introduction to ReactJSAn Introduction to ReactJS
An Introduction to ReactJS
All Things Open
 

What's hot (20)

React & Redux
React & ReduxReact & Redux
React & Redux
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with Redux
 
Getting started with Redux js
Getting started with Redux jsGetting started with Redux js
Getting started with Redux js
 
React.js and Redux overview
React.js and Redux overviewReact.js and Redux overview
React.js and Redux overview
 
Academy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & ToolingAcademy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & Tooling
 
Introduction to Redux
Introduction to ReduxIntroduction to Redux
Introduction to Redux
 
React, Flux and a little bit of Redux
React, Flux and a little bit of ReduxReact, Flux and a little bit of Redux
React, Flux and a little bit of Redux
 
Using redux
Using reduxUsing redux
Using redux
 
React / Redux Architectures
React / Redux ArchitecturesReact / Redux Architectures
React / Redux Architectures
 
Introduction to React & Redux
Introduction to React & ReduxIntroduction to React & Redux
Introduction to React & Redux
 
Redux training
Redux trainingRedux training
Redux training
 
React, Redux, ES2015 by Max Petruck
React, Redux, ES2015   by Max PetruckReact, Redux, ES2015   by Max Petruck
React, Redux, ES2015 by Max Petruck
 
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 & redux
React & reduxReact & redux
React & redux
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥
 
React JS and Redux
React JS and ReduxReact JS and Redux
React JS and Redux
 
Switch to React.js from AngularJS developer
Switch to React.js from AngularJS developerSwitch to React.js from AngularJS developer
Switch to React.js from AngularJS developer
 
React Lifecycle and Reconciliation
React Lifecycle and ReconciliationReact Lifecycle and Reconciliation
React Lifecycle and Reconciliation
 
An Introduction to ReactJS
An Introduction to ReactJSAn Introduction to ReactJS
An Introduction to ReactJS
 

Viewers also liked

Async Server Rendering in React+Redux at NYTimes (redux-taxi)
Async Server Rendering in React+Redux at NYTimes (redux-taxi)Async Server Rendering in React+Redux at NYTimes (redux-taxi)
Async Server Rendering in React+Redux at NYTimes (redux-taxi)
Jeremy Gayed
 
Mongo for the Mission Critical Enterprise
Mongo for the Mission Critical EnterpriseMongo for the Mission Critical Enterprise
Mongo for the Mission Critical EnterpriseMongoDB
 
Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016
Ben Lesh
 
RxJS + Redux + React = Amazing
RxJS + Redux + React = AmazingRxJS + Redux + React = Amazing
RxJS + Redux + React = Amazing
Jay Phelps
 
RxJS and Reactive Programming - Modern Web UI - May 2015
RxJS and Reactive Programming - Modern Web UI - May 2015RxJS and Reactive Programming - Modern Web UI - May 2015
RxJS and Reactive Programming - Modern Web UI - May 2015
Ben Lesh
 

Viewers also liked (6)

Async Server Rendering in React+Redux at NYTimes (redux-taxi)
Async Server Rendering in React+Redux at NYTimes (redux-taxi)Async Server Rendering in React+Redux at NYTimes (redux-taxi)
Async Server Rendering in React+Redux at NYTimes (redux-taxi)
 
Mongo for the Mission Critical Enterprise
Mongo for the Mission Critical EnterpriseMongo for the Mission Critical Enterprise
Mongo for the Mission Critical Enterprise
 
Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016
 
RxJS + Redux + React = Amazing
RxJS + Redux + React = AmazingRxJS + Redux + React = Amazing
RxJS + Redux + React = Amazing
 
RxJS and Reactive Programming - Modern Web UI - May 2015
RxJS and Reactive Programming - Modern Web UI - May 2015RxJS and Reactive Programming - Modern Web UI - May 2015
RxJS and Reactive Programming - Modern Web UI - May 2015
 
React js
React jsReact js
React js
 

Similar to ProvJS: Six Months of ReactJS and Redux

The History of React-Hot-Loader
The History of React-Hot-LoaderThe History of React-Hot-Loader
The History of React-Hot-Loader
Anton Korzunov
 
Learn react-js
Learn react-jsLearn react-js
Ultimate Survival - React-Native edition
Ultimate Survival - React-Native editionUltimate Survival - React-Native edition
Ultimate Survival - React-Native edition
Richard Radics
 
Universal React apps in Next.js
Universal React apps in Next.jsUniversal React apps in Next.js
Universal React apps in Next.js
🐕 Łukasz Ostrowski
 
Introduction to ReactJS and Redux
Introduction to ReactJS and ReduxIntroduction to ReactJS and Redux
Introduction to ReactJS and Redux
Boris Dinkevich
 
Using Docker in the Real World
Using Docker in the Real WorldUsing Docker in the Real World
Using Docker in the Real World
Tim Haak
 
Create ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm packageCreate ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm package
Andrii Lundiak
 
A React Journey
A React JourneyA React Journey
A React Journey
LinkMe Srl
 
Ryan Christiani I Heard React Was Good
Ryan Christiani I Heard React Was GoodRyan Christiani I Heard React Was Good
Ryan Christiani I Heard React Was Good
FITC
 
Matheus Marsiglio - Isomorphic React + Redux App
Matheus Marsiglio - Isomorphic React + Redux AppMatheus Marsiglio - Isomorphic React + Redux App
Matheus Marsiglio - Isomorphic React + Redux App
React Conf Brasil
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
Chiew Carol
 
Performance
PerformancePerformance
Performance
Varnish Software
 
A Practical Approach to React Native at All Things Open Conference
A Practical Approach to React Native at All Things Open ConferenceA Practical Approach to React Native at All Things Open Conference
A Practical Approach to React Native at All Things Open Conference
Tracy Lee
 
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
Lama K Banna
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
Tariqul islam
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
Jeff Durta
 
Aura LA GDG - July 17-2017
Aura LA GDG - July 17-2017Aura LA GDG - July 17-2017
Aura LA GDG - July 17-2017
Kristan Uccello
 
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
The Mysteries Of JavaScript-Fu (RailsConf Ediition)The Mysteries Of JavaScript-Fu (RailsConf Ediition)
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
danwrong
 
Tipping the scale - Eyal Eizenberg - Wix
Tipping the scale - Eyal Eizenberg - WixTipping the scale - Eyal Eizenberg - Wix
Tipping the scale - Eyal Eizenberg - Wix
Eyal Eizenberg
 

Similar to ProvJS: Six Months of ReactJS and Redux (20)

The History of React-Hot-Loader
The History of React-Hot-LoaderThe History of React-Hot-Loader
The History of React-Hot-Loader
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Ultimate Survival - React-Native edition
Ultimate Survival - React-Native editionUltimate Survival - React-Native edition
Ultimate Survival - React-Native edition
 
Universal React apps in Next.js
Universal React apps in Next.jsUniversal React apps in Next.js
Universal React apps in Next.js
 
Introduction to ReactJS and Redux
Introduction to ReactJS and ReduxIntroduction to ReactJS and Redux
Introduction to ReactJS and Redux
 
Using Docker in the Real World
Using Docker in the Real WorldUsing Docker in the Real World
Using Docker in the Real World
 
Create ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm packageCreate ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm package
 
A React Journey
A React JourneyA React Journey
A React Journey
 
Ryan Christiani I Heard React Was Good
Ryan Christiani I Heard React Was GoodRyan Christiani I Heard React Was Good
Ryan Christiani I Heard React Was Good
 
Matheus Marsiglio - Isomorphic React + Redux App
Matheus Marsiglio - Isomorphic React + Redux AppMatheus Marsiglio - Isomorphic React + Redux App
Matheus Marsiglio - Isomorphic React + Redux App
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
 
Performance
PerformancePerformance
Performance
 
A Practical Approach to React Native at All Things Open Conference
A Practical Approach to React Native at All Things Open ConferenceA Practical Approach to React Native at All Things Open Conference
A Practical Approach to React Native at All Things Open Conference
 
Do you queue (updated)
Do you queue (updated)Do you queue (updated)
Do you queue (updated)
 
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
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
 
Aura LA GDG - July 17-2017
Aura LA GDG - July 17-2017Aura LA GDG - July 17-2017
Aura LA GDG - July 17-2017
 
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
The Mysteries Of JavaScript-Fu (RailsConf Ediition)The Mysteries Of JavaScript-Fu (RailsConf Ediition)
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
 
Tipping the scale - Eyal Eizenberg - Wix
Tipping the scale - Eyal Eizenberg - WixTipping the scale - Eyal Eizenberg - Wix
Tipping the scale - Eyal Eizenberg - Wix
 

Recently uploaded

In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
MayankTawar1
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
NaapbooksPrivateLimi
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
Peter Caitens
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
ayushiqss
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
Jelle | Nordend
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
Sharepoint Designs
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 

Recently uploaded (20)

In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 

ProvJS: Six Months of ReactJS and Redux

Editor's Notes

  1. What I’m going to present seems to be working OK for me. It might not work for you. Try it yourself and decide.
  2. • How many people have written a simple redux app? • How many people have read some tutorials? So you’ve heard redux is pretty rad. Lots of people say it’s cool. Maybe you’ve used Angular or Ember or Backbone and Marionette. Well, react is like that, except….
  3. Also react-router and redux-simple-router. Also hot module reloading. And the source maps. Never forget the source maps. You might spend a week getting those two things working.
  4. So before you've started writing any code your package.json is going to look something like this!
  5. Let's backup for a second. What you *really* care about is actually a small number of packages. These are actually *really* simple to learn. You’ll spend 4 hours learning this, and two weeks getting the tooling to work.
  6. By the end, you’ll feel like this. So what I'm really saying is, copy someone else's boilerplate example.
  7. Let’s try to remember what we’re trying to achieve
  8. You might have seen this before. https://facebook.github.io/flux/docs/overview.html
  9. Gross oversimplification of redux. Or is it? The view executes actions via the dispatcher. Actions update the store (state) via reducers. The store updates the view via connect() to react props.
  10. This is what you see… Too simple. How do I make a server request?? Source: https://github.com/reactjs/redux/blob/master/examples/todomvc/actions/index.js
  11. The key is always return a new object when you manipulate the store. It lets redux optimize react render passes. Source: https://github.com/reactjs/redux/blob/master/examples/todomvc/reducers/todos.js
  12. Ok so that's what you (probably) already knew about redux.
  13. If you’re use Python’s record type or Ruby’s struct… it’s just like that. Easy peasy data classes. Immutability is pretty much essential for redux because of how it optimizes updates. Immutable.js is definitely cleaner than using Object.assign and spread/ rest to create new objects. (It’s also faster.)
  14. If you’re use Python’s record type or Ruby’s struct… it’s just like that. Easy peasy data classes. Immutability is pretty much essential for redux because of how it optimizes updates. Immutable.js is definitely cleaner than using Object.assign and spread/ rest to create new objects. (It’s also faster.)
  15. Should stores hold a single object? A list if it’s
  16. I’ve got a list of nested items on the left… So immediately I know I need stores to hold a sequence of items. But also I need to be able to determine relations between items. (Normalizr helps with this.) In addition to the same item appearing both in the list and the main section. Long term you might want something like an LRU to deal with paging and data bloat.
  17. I need to be able to determine relations between items. (Normalizr helps with this.) I decided stores should be maps of my domain models. They have child/parent ID references so you can lookup corresponding parent children in each store. Long term you might want something like an LRU to deal with paging and data bloat.
  18. The reason why actions are disconnected from reducers is because they are not always 1-to-1. On line 35 the transmitter (child) reducer is populating the store from children in a fetched parent object.
  19. Let's look at connecting your store to view components. The connect method of react-redux is awesome. • Components are completely unaware of redux. • Connect() wrapped components have stores (state) and actions injected into props. • This makes un-connected components easily testable. • If you've done Java/Spring this feels like dependency injection
  20. This is why you need redux-thunk. Basically to do anything async. IDK why it’s not part of redux or react-redux. When you execute your action, return the promise and you can do things like navigation, close a dialog, etc. when the action completes.
  21. On line 81 I’m calling an action then closing a dialog and navigating to a new page (line 83) when successful. I could also perform specific steps if the action failed (e.g. 409 conflict on the server) If you ask me this is more appropriate place to put this logic than e.g. by getting a result from a store.
  22. Components wrapped in connect() can’t be searched for by Component name in shallow render tests. :( Erik Ras proposes exposing both a connected and non-connected component. See: https://github.com/erikras/ducks-modular-redux But testing stores is trivial!!!
  23. The connect() method has a workaround: see the `withRef` option. https://github.com/reactjs/react-redux/blob/master/docs/api.md This is actually a perfect example of how react state “traps” the application state.
  24. Instead of calling a method to get or change a component’s state, consider passing it from child to parent via a callback, and/or changing by dispatching a redux action. • Benefit: any part of the view heirarchy can now manipulate that state. E.g. a root view closing all dialogs. • Line 23 is calling a redux action. • Line 29 is an example of calling `closeDialogAction` in a promise chain
  25. The connect() method has a workaround: see the `withRef` option. https://github.com/reactjs/react-redux/blob/master/docs/api.md
  26. Should stores hold a single object? A list if it’s
  27. Actions that might be required by multiple disconnected components (e.g. initial data on page load) can easily be debounced to multiple expensive requests.
  28. This is how I manage the loading state. actionStarted() dispatches a loading increment action dispatchActionComplete() and dispatchError() does a decrement.
  29. Redux form solves the problem of trapping current form value in state
  30. Code for validation is trivial
  31. Andrew did a great presentation last month about React.js and I don’t think he used any flux framework. It works! • The unidirectional data flow does great things by itself. • You can build the rest (remote calls + app state) without too much effort.
  32. I’m thinking about ordering some shirts on Teespring – who’s interested? :D The end.
  33. I work at VoltServer – we make some pretty cool power disitribution technology. Ask me about Digital Electricity. It’s pretty rad.
  34. Extra stuff if there are questions.
  35. Actions are simple… Really simple.
  36. Replaced standard fetch actions with thunks to create cookie-cutter actions.
  37. Actions that might be required by multiple disconnected components (e.g. initial data on page load) can easily be debounced to multiple expensive requests.