SlideShare uma empresa Scribd logo
1 de 31
Baixar para ler offline
React+Redux
Workshops
Marcin Grzywaczewski (@Killavus)
Arkency
What
• An app for managing conferences
• Planning conferences
• Scheduling conference days
• Accepting events from CFP (call for papers)
• Scheduling events within conference days
How
• React.js and Redux will be used to create an
interface
• HTML Mockups are prepared so you can base on
it (I’ll be happy if you experiment with your own
solutions, though)
• Project with an API and all needed libraries is
provided
• One view = one React.js+Redux application
React.js
• Responsible for rendering HTML.
• A function which takes properties and returns HTML.
• You create components which are small pieces of your
interface and you compose them together.
• React.js uses JSX syntax, which is very similar to
HTML.
• There is a concept of state, but thanks to Redux it is
unnecessary.
Component as function
JSBin Code
Component as React class
JSBin Code
Composing components
How to make it dynamic?
• You can’t change props!
• You can call ReactDOM.render again. It is fast,
thanks to React.js internal algorithms.
• There is a concept of state, but we won’t use it
beacuse you don’t need it.
Dynamic component?
JSBin Code
What if…
• You can have some piece of data needed to
render a component.
• Every time a piece of data changes you re-
render your component. Your component is
notified somehow about the change.
• This is what Redux will provide to us.
Redux
• Manages the data flow in your application.
• You emit actions which are like parameters for Rails
update endpoint (but named!). Actions are created by
action creators.
• Actions modify state.
• State is stored within a store.
• How an action modifies state is determined by a
reducer.
Greeter with React+Redux
• A function is called an app when contains:
• React components
• Redux building blocks
• Let’s create a GreeterApp, step by step.
Empty App
Initial State
Action Creator
A return value of this function is called an action.
Reducer
Reducer recap
• A reducer is a function which takes the current
state and an action and returns the new state
based on an action processed.
• The return value must be a new object. No
mutated values allowed!
Wrongly written reducer
(mutation of state)
Store
You may consider store as a Redux internal thing.
All you need to do is to pass a reducer and initial state and
you are done.
Components
Components recap
• The new property will be passed -
nameChanged which is a function passed to
onChange of GreeterEdit.
• Components are blissfully unaware of being
managed by Redux ;).
• But how to connect React + Redux together?
Connecting React & Redux
• To connect React.js components with Redux stores
you need create a connector.
• Connector is a pair of state mapper and dispatch
mapper.
• State mapper takes your state and produces an object
which will be merged to component’s properties.
• Dispatch mapper exposes dispatch function which
passes actions to a store. It returns an object which
will get merged to component’s properties too.
Dispatch & State mappers
Notice how action creator is used to create an action emitted
to a store. It is not a coincidence!
connect function
• connect function takes your state mapper and
dispatch mapper and creates a connector. It is a
function.
• To make your component connected you just
pass a component as an argument to a
connector.
Connector & Connected
Component
Provider
• We know how to map state to properties and
we’re exposing functions for dispatching
actions. But we don’t know where to dispatch
our actions!
• There is a Provider component. You wrap your
connected component with it. It takes store as a
property.
Provider usage & return
value of the GreeterApp
GreeterApp Usage
GreeterApp Code
JSBin Code
Summary
• React.js is great for defining your user interface in
the declarative way.
• Redux is great for managing the data flow in a
simple way.
• You can connect the two together, removing the
problem of updating React components.
• Component’s built-in state is not needed. It is the
most troubling part of React components!
Good luck!

Mais conteúdo relacionado

Mais procurados

State Models for React with Redux
State Models for React with ReduxState Models for React with Redux
State Models for React with ReduxStephan Schmidt
 
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 Lifecycle and Reconciliation
React Lifecycle and ReconciliationReact Lifecycle and Reconciliation
React Lifecycle and ReconciliationZhihao Li
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥Remo Jansen
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practicesfloydophone
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with ReduxVedran Blaženka
 
Building Modern Web Applications using React and Redux
 Building Modern Web Applications using React and Redux Building Modern Web Applications using React and Redux
Building Modern Web Applications using React and ReduxMaxime Najim
 
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
 
React for Dummies
React for DummiesReact for Dummies
React for DummiesMitch Chen
 
Academy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & ToolingAcademy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & ToolingBinary Studio
 
Introduction to react
Introduction to reactIntroduction to react
Introduction to reactkiranabburi
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.jsEmanuele DelBono
 
Workshop 22: React-Redux Middleware
Workshop 22: React-Redux MiddlewareWorkshop 22: React-Redux Middleware
Workshop 22: React-Redux MiddlewareVisual Engineering
 
React JS and Redux
React JS and ReduxReact JS and Redux
React JS and ReduxGlib Kechyn
 
React.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOMReact.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOMJimit Shah
 

Mais procurados (20)

React / Redux Architectures
React / Redux ArchitecturesReact / Redux Architectures
React / Redux Architectures
 
State Models for React with Redux
State Models for React with ReduxState Models for React with Redux
State Models for React with Redux
 
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 Lifecycle and Reconciliation
React Lifecycle and ReconciliationReact Lifecycle and Reconciliation
React Lifecycle and Reconciliation
 
How to Redux
How to ReduxHow to Redux
How to Redux
 
Angular redux
Angular reduxAngular redux
Angular redux
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practices
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with Redux
 
React & redux
React & reduxReact & redux
React & redux
 
Building Modern Web Applications using React and Redux
 Building Modern Web Applications using React and Redux Building Modern Web Applications using React and Redux
Building Modern Web Applications using React and 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.
 
React for Dummies
React for DummiesReact for Dummies
React for Dummies
 
Academy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & ToolingAcademy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & Tooling
 
Intro to ReactJS
Intro to ReactJSIntro to ReactJS
Intro to ReactJS
 
Introduction to react
Introduction to reactIntroduction to react
Introduction to react
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.js
 
Workshop 22: React-Redux Middleware
Workshop 22: React-Redux MiddlewareWorkshop 22: React-Redux Middleware
Workshop 22: React-Redux Middleware
 
React JS and Redux
React JS and ReduxReact JS and Redux
React JS and Redux
 
React.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOMReact.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOM
 

Destaque

React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux IntroductionNikolaus Graf
 
MSBI LIVE & VIDEO TRAINING From SQL-SCHOOL
MSBI LIVE & VIDEO TRAINING From SQL-SCHOOLMSBI LIVE & VIDEO TRAINING From SQL-SCHOOL
MSBI LIVE & VIDEO TRAINING From SQL-SCHOOLSequelGate
 
Presentation5
Presentation5Presentation5
Presentation5rian_foe
 
ScienceSoft: Open Software for Open Science
ScienceSoft: Open Software for Open ScienceScienceSoft: Open Software for Open Science
ScienceSoft: Open Software for Open ScienceSoftwarePractice
 
Presentation2
Presentation2Presentation2
Presentation2rian_foe
 
Why would we want to talk to customers or them to us? TCUK 2012
Why would we want to talk to customers or them to us? TCUK 2012Why would we want to talk to customers or them to us? TCUK 2012
Why would we want to talk to customers or them to us? TCUK 2012Ian Ampleford
 
Mortal instruments program days rr
Mortal instruments program days rrMortal instruments program days rr
Mortal instruments program days rrlehicks
 
Presentation1
Presentation1Presentation1
Presentation1rian_foe
 

Destaque (12)

React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
 
React & Redux
React & ReduxReact & Redux
React & Redux
 
AIA Studio 111 Folio
AIA Studio 111 FolioAIA Studio 111 Folio
AIA Studio 111 Folio
 
MSBI LIVE & VIDEO TRAINING From SQL-SCHOOL
MSBI LIVE & VIDEO TRAINING From SQL-SCHOOLMSBI LIVE & VIDEO TRAINING From SQL-SCHOOL
MSBI LIVE & VIDEO TRAINING From SQL-SCHOOL
 
Presentation5
Presentation5Presentation5
Presentation5
 
Ikf presentation
Ikf presentationIkf presentation
Ikf presentation
 
ScienceSoft: Open Software for Open Science
ScienceSoft: Open Software for Open ScienceScienceSoft: Open Software for Open Science
ScienceSoft: Open Software for Open Science
 
Presentation2
Presentation2Presentation2
Presentation2
 
Why would we want to talk to customers or them to us? TCUK 2012
Why would we want to talk to customers or them to us? TCUK 2012Why would we want to talk to customers or them to us? TCUK 2012
Why would we want to talk to customers or them to us? TCUK 2012
 
Mortal instruments program days rr
Mortal instruments program days rrMortal instruments program days rr
Mortal instruments program days rr
 
Presentation1
Presentation1Presentation1
Presentation1
 
Ke toan tai_chinh_02
Ke toan tai_chinh_02Ke toan tai_chinh_02
Ke toan tai_chinh_02
 

Semelhante a React.js+Redux Workshops

React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
Introduction to React, Flux, and Isomorphic Apps
Introduction to React, Flux, and Isomorphic AppsIntroduction to React, Flux, and Isomorphic Apps
Introduction to React, Flux, and Isomorphic AppsFederico Torre
 
Getting started with react & redux
Getting started with react & reduxGetting started with react & redux
Getting started with react & reduxGirish Talekar
 
Spfx with react redux
Spfx with react reduxSpfx with react redux
Spfx with react reduxRajesh Kumar
 
An Overview of the React Ecosystem
An Overview of the React EcosystemAn Overview of the React Ecosystem
An Overview of the React EcosystemFITC
 
FRONTEND BOOTCAMP 4.pptx
FRONTEND BOOTCAMP 4.pptxFRONTEND BOOTCAMP 4.pptx
FRONTEND BOOTCAMP 4.pptxEhtesham46
 
downloads_introduction to redux.pptx
downloads_introduction to redux.pptxdownloads_introduction to redux.pptx
downloads_introduction to redux.pptxNavneetKumar111924
 
Reactjs notes.pptx for web development- tutorial and theory
Reactjs  notes.pptx for web development- tutorial and theoryReactjs  notes.pptx for web development- tutorial and theory
Reactjs notes.pptx for web development- tutorial and theoryjobinThomas54
 
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...
Дмитрий Тежельников  «Разработка вэб-решений с использованием Asp.NET.Core и ...Дмитрий Тежельников  «Разработка вэб-решений с использованием Asp.NET.Core и ...
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...MskDotNet Community
 
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
 
React and Flux life cycle with JSX, React Router and Jest Unit Testing
React and  Flux life cycle with JSX, React Router and Jest Unit TestingReact and  Flux life cycle with JSX, React Router and Jest Unit Testing
React and Flux life cycle with JSX, React Router and Jest Unit TestingEswara Kumar Palakollu
 
Introduction to React JS.pptx
Introduction to React JS.pptxIntroduction to React JS.pptx
Introduction to React JS.pptxSHAIKIRFAN715544
 
Introduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptxIntroduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptxSHAIKIRFAN715544
 
Understanding Facebook's React.js
Understanding Facebook's React.jsUnderstanding Facebook's React.js
Understanding Facebook's React.jsFederico Torre
 
React js programming concept
React js programming conceptReact js programming concept
React js programming conceptTariqul islam
 
Building React Applications with Redux
Building React Applications with ReduxBuilding React Applications with Redux
Building React Applications with ReduxFITC
 

Semelhante a React.js+Redux Workshops (20)

React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Introduction to React, Flux, and Isomorphic Apps
Introduction to React, Flux, and Isomorphic AppsIntroduction to React, Flux, and Isomorphic Apps
Introduction to React, Flux, and Isomorphic Apps
 
Getting started with react & redux
Getting started with react & reduxGetting started with react & redux
Getting started with react & redux
 
Spfx with react redux
Spfx with react reduxSpfx with react redux
Spfx with react redux
 
Reactjs
Reactjs Reactjs
Reactjs
 
Redux Like Us
Redux Like UsRedux Like Us
Redux Like Us
 
reactJS
reactJSreactJS
reactJS
 
An Overview of the React Ecosystem
An Overview of the React EcosystemAn Overview of the React Ecosystem
An Overview of the React Ecosystem
 
FRONTEND BOOTCAMP 4.pptx
FRONTEND BOOTCAMP 4.pptxFRONTEND BOOTCAMP 4.pptx
FRONTEND BOOTCAMP 4.pptx
 
downloads_introduction to redux.pptx
downloads_introduction to redux.pptxdownloads_introduction to redux.pptx
downloads_introduction to redux.pptx
 
React
ReactReact
React
 
Reactjs notes.pptx for web development- tutorial and theory
Reactjs  notes.pptx for web development- tutorial and theoryReactjs  notes.pptx for web development- tutorial and theory
Reactjs notes.pptx for web development- tutorial and theory
 
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...
Дмитрий Тежельников  «Разработка вэб-решений с использованием Asp.NET.Core и ...Дмитрий Тежельников  «Разработка вэб-решений с использованием Asp.NET.Core и ...
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...
 
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 and Flux life cycle with JSX, React Router and Jest Unit Testing
React and  Flux life cycle with JSX, React Router and Jest Unit TestingReact and  Flux life cycle with JSX, React Router and Jest Unit Testing
React and Flux life cycle with JSX, React Router and Jest Unit Testing
 
Introduction to React JS.pptx
Introduction to React JS.pptxIntroduction to React JS.pptx
Introduction to React JS.pptx
 
Introduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptxIntroduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptx
 
Understanding Facebook's React.js
Understanding Facebook's React.jsUnderstanding Facebook's React.js
Understanding Facebook's React.js
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
 
Building React Applications with Redux
Building React Applications with ReduxBuilding React Applications with Redux
Building React Applications with Redux
 

Último

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 

Último (20)

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

React.js+Redux Workshops

  • 2. What • An app for managing conferences • Planning conferences • Scheduling conference days • Accepting events from CFP (call for papers) • Scheduling events within conference days
  • 3. How • React.js and Redux will be used to create an interface • HTML Mockups are prepared so you can base on it (I’ll be happy if you experiment with your own solutions, though) • Project with an API and all needed libraries is provided • One view = one React.js+Redux application
  • 4. React.js • Responsible for rendering HTML. • A function which takes properties and returns HTML. • You create components which are small pieces of your interface and you compose them together. • React.js uses JSX syntax, which is very similar to HTML. • There is a concept of state, but thanks to Redux it is unnecessary.
  • 6. Component as React class JSBin Code
  • 8. How to make it dynamic? • You can’t change props! • You can call ReactDOM.render again. It is fast, thanks to React.js internal algorithms. • There is a concept of state, but we won’t use it beacuse you don’t need it.
  • 10. What if… • You can have some piece of data needed to render a component. • Every time a piece of data changes you re- render your component. Your component is notified somehow about the change. • This is what Redux will provide to us.
  • 11. Redux • Manages the data flow in your application. • You emit actions which are like parameters for Rails update endpoint (but named!). Actions are created by action creators. • Actions modify state. • State is stored within a store. • How an action modifies state is determined by a reducer.
  • 12. Greeter with React+Redux • A function is called an app when contains: • React components • Redux building blocks • Let’s create a GreeterApp, step by step.
  • 15. Action Creator A return value of this function is called an action.
  • 17. Reducer recap • A reducer is a function which takes the current state and an action and returns the new state based on an action processed. • The return value must be a new object. No mutated values allowed!
  • 19. Store You may consider store as a Redux internal thing. All you need to do is to pass a reducer and initial state and you are done.
  • 21. Components recap • The new property will be passed - nameChanged which is a function passed to onChange of GreeterEdit. • Components are blissfully unaware of being managed by Redux ;). • But how to connect React + Redux together?
  • 22. Connecting React & Redux • To connect React.js components with Redux stores you need create a connector. • Connector is a pair of state mapper and dispatch mapper. • State mapper takes your state and produces an object which will be merged to component’s properties. • Dispatch mapper exposes dispatch function which passes actions to a store. It returns an object which will get merged to component’s properties too.
  • 23. Dispatch & State mappers Notice how action creator is used to create an action emitted to a store. It is not a coincidence!
  • 24. connect function • connect function takes your state mapper and dispatch mapper and creates a connector. It is a function. • To make your component connected you just pass a component as an argument to a connector.
  • 26. Provider • We know how to map state to properties and we’re exposing functions for dispatching actions. But we don’t know where to dispatch our actions! • There is a Provider component. You wrap your connected component with it. It takes store as a property.
  • 27. Provider usage & return value of the GreeterApp
  • 30. Summary • React.js is great for defining your user interface in the declarative way. • Redux is great for managing the data flow in a simple way. • You can connect the two together, removing the problem of updating React components. • Component’s built-in state is not needed. It is the most troubling part of React components!