SlideShare a Scribd company logo
REACT AND REDUX
MAKE THE WEB FUN AGAIN
/Andrew Lombardi @kinabalu
Mystic Coders, LLC
ABOUT ME
ABOUT ME
16 Years in Business
8 Years @ Java2Days
Published Author
So ware Consultants
International Speakers
Invented the Internet
Training
 
To our success!
WEBSOCKET BOOK
http://bit.ly/lombardi_websocket_book
KEY POINTS
Functional programming is awesome (avoid change in state,
immutable)
Components are beautiful
JavaScript sucks, but React and Redux with ES6 make it
bearable
How it Feels to Learn JavaScript in 2016
APACHE WICKET
TM
Circa 2005
Component-based
Just Java and Just HTML
REACT IS...
Circa 2013
Component-based
Just JavaScript and JSX (embedded XML)
Only the 'V' in MVC
No ugly templates
REACT LIFECYCLE
MOUNTING
Called when component created or inserted into DOM
UPDATING
Changes to props or state or component re-render
VIRTUAL DOM
REACT'S SOLUTION TO FAST DOM UPDATES
Pure JavaScript
In-memory representation of DOM
render() runs whenever something changes
Diffs with the old one
Batch executes all queued updates
CONVENTIONS FOR THIS TALK
Code will be using ES6, transpiled using Babel
Uses npm scripts rather than Grunt or Gulp
yarn instead of npm because it's superior
by
REACT STARTER KIT
React Slingshot Cory House
Includes all necessary tooling to be successful with React
and Redux
HANDS-ON DEMO
FUNCTIONAL STATELESS
COMPONENTS
Also called presentational/dumb components
import React from ‘react’;
const HelloWorld = ({name}) => (
<div>Hello, {name}!}</div>
);
export default HelloWorld;
CONTAINER COMPONENTS
The stateful kind
class HelloWorldContainer extends React.Component {
constructor() {
super();
this.setState({
name: ''
});
}
componentDidMount() {
// do stuff to fill from external sources/APIs
}
render() {
return <HelloWorld name={this.state.name} />;
}
}
setState()
Performs shallow merge of next state into current state.
Triggers eventual UI update.
propTypes
a property on the component class, defines what types the
props should be.
In dev mode, warning is shown but skipped in prod for efficiency
props
properties defined by the called of the component
state
user-defined data defined by the component as a plain-ole
javascript object
modified using setState() so it is queued properly with other updates
HANDS-ON DEMO
RESOURCES FOR REACT
React.js Docs
Thinking in React
REDUX
REDUX
A better Flux implementation
A predictable state container for JavaScript apps
No dispatcher, Single store, Immutable
FLUX ARCHITECTURE
React and redux
ACTION CREATORS
function savePaste(code) {
return {
type: SAVE_PASTE,
code
}
}
REDUCERS
const INITIAL_STATE = {
pastes: {
paste: null,
error: null,
loading: false
}
};
export default function pasteReducer(state = INITIAL_STATE, action) {
switch (action.type) {
case SAVE_PASTE:
return { ...state, pastes: { paste: null, error:
default:
return state
}
}
MAPPING STATE AND DISPATCH
import { connect } from 'react-redux';
const mapDispatchToProps = (dispatch) => {
// maps dispatch actions for executing action creators to props
};
function mapStateToProps(state) {
// contains state from store and allows mapping to props
}
export default connect(
mapStateToProps,
mapDispatchToProps)
(MyLittleComponent);
ACTION DISPATCH
const mapDispatchToProps = (dispatch) => {
return {
loadPasteById: (pasteId) => {
dispatch(pasteActions.loadPasteById(pasteId));
}
};
};
CALLING ACTION VIA PROPS
componentWillMount() {
this.props.loadPasteById(this.props.pasteId);
}
HANDS-ON DEMO
RESOURCES FOR REDUX
Main Redux Docs
Redux Tutorial
Full Stack Redux Tutorial
3 THINGS ABOUT REACT
Pure components
One-way data binding
Fast
3 THINGS ABOUT REDUX
A single Store
No dispatcher
Immutable
FIN
Q & A
ANDREW LOMBARDI / @KINABALU
Mystic Coders, LLC
bit.ly/lombardi_websocket_book
https://github.com/kinabalu/react_and_redux

More Related Content

PDF
Introduction to Redux
Ignacio Martín
 
ODP
Introduction to ReactJS
Knoldus Inc.
 
PPTX
React js programming concept
Tariqul islam
 
PDF
ReactJS presentation
Thanh Tuong
 
PPTX
React hooks
Assaf Gannon
 
PPTX
Intro to React
Justin Reock
 
PPTX
Understanding react hooks
Maulik Shah
 
PDF
React
중운 박
 
Introduction to Redux
Ignacio Martín
 
Introduction to ReactJS
Knoldus Inc.
 
React js programming concept
Tariqul islam
 
ReactJS presentation
Thanh Tuong
 
React hooks
Assaf Gannon
 
Intro to React
Justin Reock
 
Understanding react hooks
Maulik Shah
 
React
중운 박
 

What's hot (20)

PPTX
React js for beginners
Alessandro Valenti
 
PPTX
React + Redux Introduction
Nikolaus Graf
 
PDF
React JS - Introduction
Sergey Romaneko
 
PPTX
Introduction to React JS for beginners | Namespace IT
namespaceit
 
PPTX
React JS: A Secret Preview
valuebound
 
PPTX
Introduction to React
Rob Quick
 
PDF
React Context API
NodeXperts
 
PPTX
React.js - The Dawn of Virtual DOM
Jimit Shah
 
PPTX
Its time to React.js
Ritesh Mehrotra
 
PDF
Understanding react hooks
Samundra khatri
 
PPTX
Introduction to react_js
MicroPyramid .
 
PPTX
React workshop
Imran Sayed
 
PDF
An introduction to React.js
Emanuele DelBono
 
PPTX
React js
Oswald Campesato
 
PPTX
reactJS
Syam Santhosh
 
PPTX
Introduction to React JS for beginners
Varun Raj
 
PPTX
ReactJs
Sahana Banerjee
 
PDF
Introduction to React JS
Bethmi Gunasekara
 
PDF
An Introduction to Redux
NexThoughts Technologies
 
PPTX
Redux workshop
Imran Sayed
 
React js for beginners
Alessandro Valenti
 
React + Redux Introduction
Nikolaus Graf
 
React JS - Introduction
Sergey Romaneko
 
Introduction to React JS for beginners | Namespace IT
namespaceit
 
React JS: A Secret Preview
valuebound
 
Introduction to React
Rob Quick
 
React Context API
NodeXperts
 
React.js - The Dawn of Virtual DOM
Jimit Shah
 
Its time to React.js
Ritesh Mehrotra
 
Understanding react hooks
Samundra khatri
 
Introduction to react_js
MicroPyramid .
 
React workshop
Imran Sayed
 
An introduction to React.js
Emanuele DelBono
 
reactJS
Syam Santhosh
 
Introduction to React JS for beginners
Varun Raj
 
Introduction to React JS
Bethmi Gunasekara
 
An Introduction to Redux
NexThoughts Technologies
 
Redux workshop
Imran Sayed
 
Ad

Similar to React and redux (20)

PPTX
Combining Angular and React Together
Sebastian Pederiva
 
PPTX
Build web apps with react js
dhanushkacnd
 
PPTX
ReactJS
Ram Murat Sharma
 
PPTX
[Final] ReactJS presentation
洪 鹏发
 
PPTX
Intro react js
Vijayakanth MP
 
PPTX
BackboneJS + ReactJS
Skanda Shastry
 
PPTX
React/Redux
Durgesh Vaishnav
 
PDF
Simple React Todo List
Ritesh Chaudhari
 
PDF
React & ES6 Intro
Yair Aviner
 
PDF
Fundamental concepts of react js
StephieJohn
 
PDF
A React Journey
LinkMe Srl
 
PDF
React state managmenet with Redux
Vedran Blaženka
 
PPTX
React + Redux + TypeScript === ♥
Remo Jansen
 
PDF
Building cross-platform mobile apps with React Native (Jfokus 2017)
Maarten Mulders
 
PPTX
Interview Questions On React JS.pptx
DucatNoida1
 
PPTX
React & Redux for noobs
[T]echdencias
 
PPTX
ReactJS (1)
George Tony
 
PPTX
React 101 by Anatoliy Sieryi
Binary Studio
 
PDF
A full introductory guide to React
Jean Carlo Emer
 
Combining Angular and React Together
Sebastian Pederiva
 
Build web apps with react js
dhanushkacnd
 
[Final] ReactJS presentation
洪 鹏发
 
Intro react js
Vijayakanth MP
 
BackboneJS + ReactJS
Skanda Shastry
 
React/Redux
Durgesh Vaishnav
 
Simple React Todo List
Ritesh Chaudhari
 
React & ES6 Intro
Yair Aviner
 
Fundamental concepts of react js
StephieJohn
 
A React Journey
LinkMe Srl
 
React state managmenet with Redux
Vedran Blaženka
 
React + Redux + TypeScript === ♥
Remo Jansen
 
Building cross-platform mobile apps with React Native (Jfokus 2017)
Maarten Mulders
 
Interview Questions On React JS.pptx
DucatNoida1
 
React & Redux for noobs
[T]echdencias
 
ReactJS (1)
George Tony
 
React 101 by Anatoliy Sieryi
Binary Studio
 
A full introductory guide to React
Jean Carlo Emer
 
Ad

More from Mystic Coders, LLC (6)

PDF
Infrastructure As Code With Terraform
Mystic Coders, LLC
 
PDF
Privacy in the Age of Analytica
Mystic Coders, LLC
 
PDF
The Three Keys To Remote Team Success
Mystic Coders, LLC
 
PDF
Privacy in the Age of Analytica
Mystic Coders, LLC
 
PDF
In depth with html5 java2days 2010
Mystic Coders, LLC
 
KEY
Architecting Applications Using Apache Wicket Java2 Days 2009
Mystic Coders, LLC
 
Infrastructure As Code With Terraform
Mystic Coders, LLC
 
Privacy in the Age of Analytica
Mystic Coders, LLC
 
The Three Keys To Remote Team Success
Mystic Coders, LLC
 
Privacy in the Age of Analytica
Mystic Coders, LLC
 
In depth with html5 java2days 2010
Mystic Coders, LLC
 
Architecting Applications Using Apache Wicket Java2 Days 2009
Mystic Coders, LLC
 

Recently uploaded (20)

PPTX
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
DOCX
The Five Best AI Cover Tools in 2025.docx
aivoicelabofficial
 
PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
PPTX
Explanation about Structures in C language.pptx
Veeral Rathod
 
PPTX
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
PDF
Teaching Reproducibility and Embracing Variability: From Floating-Point Exper...
University of Rennes, INSA Rennes, Inria/IRISA, CNRS
 
PDF
Micromaid: A simple Mermaid-like chart generator for Pharo
ESUG
 
PDF
Bandai Playdia The Book - David Glotz
BluePanther6
 
PDF
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
QAware GmbH
 
PDF
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
Q-Advise
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PPTX
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
PPTX
Odoo Integration Services by Candidroot Solutions
CandidRoot Solutions Private Limited
 
PDF
How to Seamlessly Integrate Salesforce Data Cloud with Marketing Cloud.pdf
NSIQINFOTECH
 
PDF
Solar Panel Installation Guide – Step By Step Process 2025.pdf
CRMLeaf
 
PPTX
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 
PDF
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
PPTX
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
PPTX
Role Of Python In Programing Language.pptx
jaykoshti048
 
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
The Five Best AI Cover Tools in 2025.docx
aivoicelabofficial
 
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
Explanation about Structures in C language.pptx
Veeral Rathod
 
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
Teaching Reproducibility and Embracing Variability: From Floating-Point Exper...
University of Rennes, INSA Rennes, Inria/IRISA, CNRS
 
Micromaid: A simple Mermaid-like chart generator for Pharo
ESUG
 
Bandai Playdia The Book - David Glotz
BluePanther6
 
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
QAware GmbH
 
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
Q-Advise
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
Odoo Integration Services by Candidroot Solutions
CandidRoot Solutions Private Limited
 
How to Seamlessly Integrate Salesforce Data Cloud with Marketing Cloud.pdf
NSIQINFOTECH
 
Solar Panel Installation Guide – Step By Step Process 2025.pdf
CRMLeaf
 
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
Role Of Python In Programing Language.pptx
jaykoshti048
 

React and redux