SlideShare una empresa de Scribd logo
1 de 22
Descargar para leer sin conexión
React in 2018
by Michael Yagudaev
About Michael
• Co-Founder @ Nano 3 Labs & PictureThat

• Full-stack Developer Rails/React

• Been working with React since 2014

• Web dev since 2001

• Passionate about AR

• Fun Fact: Snowboarding is my freedom
Outline
• The Web Before React
• The History of React
• Lessons We Learned
• Our hope for a better tomorrow
Before React
2006
2010
2010
2010-2011
React is Born!
• In May 2013, Facebook brought us React
• Idea for Virtual DOM came from Doom 3 Engine
• Based on solid Computer Science design principles:
• Composition
• Encapsulation
• Unidirectional dependency
Flux Architecture
• In 2014 Facebook introduced us to Flux
• Solved the problem of State management on a global
(application) level
Redux is Born
• In 2015 Dan Abramov introduced us to Redux
• Inspired by Flux and Elm
• Single store architecture
• Composable reducers
• Focus on immutable data
Create React App is Born
• In 2016 we got a zero-config, official way to start a
react project
• Comes with
• Webpack
• Jest Test framework
• ES6
• ESLint
2017
• Static Typing became important: TypeScript
• GraphQL as Replacement of REST
+
2018?
• Let’s switch gears…
• What else do we need to create a real app?
• beyond create-react-app
• Is it really zero-config?
• wait, where is the server in all of this?
Apps We Want to Build
• Single Page Applications
• Responsive User Interface
• Easy for new developers to work with
• Extendable beyond browser, native desktop, mobile,
etc
• Fault tolerant (i.e. less bugs)
Let’s add the usual suspects
• Add eslint-config-standard
• Add React Router
• Add Redux
• Easy to do, just go to README and follow instructions
• Still… it takes time… :(
What about CSS?
• CSS is global scope, not great
• It is often used for state level changes (:hover, :visited,
.active)
• We need something better
• inline-styles are great, but there are better things:
• JSS or Styled Components
• See Material UI @ 1.0.0 for e.g.
How do we get data?
users
posts
Server
comments
users
posts
Client
comments
normalized normalized
REACT UI
REST/GraphQL
Http
Http
denormalized
Post 1
by John Doe
4 Comments
Post 2
by John Doe
7 Comments
Http
new
sync
How does it look like in
Redux?
{
users: {
items: {
1: { id: 1, name: 'Bob Smith', ... }
...
},
meta: { fetching: false, errors: [] }
}
posts: {
items: {
1: { id: 1, userId: 1, comments: [1, 2, 3] }
},
...
},
comments: { ... }
}
Redux (cont’d)
// actions/users.js
import { fetch } from 'fetch-redux-crud'
export const fetchUsers = _ => dispatch =>
dispatch(fetch('users', { path: 'users' }))
// reducers/users.js
import { reducersFor } from 'fetch-redux-crud'
export default reducersFor('users')
Redux (cont’d)
// selectors/users.js
import values from 'lodash/values'
const getUsers = (state) => values(state.users.items)
const getUsersById = (state) => state.users.items
// e.g. getUsersById(state)[2]
Where do you denormalize?
• Denormalize inside of selectors
• Before passing down to React
• Remember, keep the # of containers in the app low
Tips for using APIs
• Take only what you need (easier with GraphQL)
• Go through a single entry point e.g.`/lib/api.js`
• Keep it DRY, just because it is Redux
• look at `redux-crud` library
• Develop a naming convention for selectors
• Use React 16 Error Boundaries
File Structure
./src
actions/
components/
routes/
containers/
routes/
lib/
reducers/
selectors/
services/ <- optional
styles/ <- theme
index.js <- entry point
./tests
structure by type, than by feature
Wish List
• End-to-End Testing Framework
• create-react-app option to run a full-setup with redux
out-of-the-box
• Generators
• Library authors creating Test Helpers
Questions?
• twitter: @yagudaev, @nano3labs
• P.S. We’re Hiring…

Más contenido relacionado

La actualidad más candente

Entity Framework Core 1.0
Entity Framework Core 1.0Entity Framework Core 1.0
Entity Framework Core 1.0Senthil Kumar
 
Modern javascript
Modern javascriptModern javascript
Modern javascriptKevin Ball
 
Building Modern Web Applications with ASP.NET5
Building Modern Web Applications with ASP.NET5Building Modern Web Applications with ASP.NET5
Building Modern Web Applications with ASP.NET5Brij Mishra
 
Building rest services using aspnetwebapi
Building rest services using aspnetwebapiBuilding rest services using aspnetwebapi
Building rest services using aspnetwebapiBrij Mishra
 
2011 - SharePoint + jQuery
2011 - SharePoint + jQuery2011 - SharePoint + jQuery
2011 - SharePoint + jQueryChris O'Connor
 
The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...Mark Roden
 
User-percieved performance
User-percieved performanceUser-percieved performance
User-percieved performanceMike North
 
Stencil JS for Framework Free Web Components | Steven Zelek
Stencil JS for Framework Free Web Components | Steven ZelekStencil JS for Framework Free Web Components | Steven Zelek
Stencil JS for Framework Free Web Components | Steven ZelekIlyaDmitriev11
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6Rob Eisenberg
 
Single page application
Single page applicationSingle page application
Single page applicationJeremy Lee
 
Scaling Tech in Asia
Scaling Tech in AsiaScaling Tech in Asia
Scaling Tech in AsiaLester Chan
 
single page application
single page applicationsingle page application
single page applicationRavindra K
 
Getting SEO performance in Angular Meteor with ngmeta
Getting SEO performance in Angular Meteor with ngmetaGetting SEO performance in Angular Meteor with ngmeta
Getting SEO performance in Angular Meteor with ngmetaWill Haire
 
React + Flux = Joy
React + Flux = JoyReact + Flux = Joy
React + Flux = JoyJohn Need
 

La actualidad más candente (20)

Single Page Application
Single Page ApplicationSingle Page Application
Single Page Application
 
Entity Framework Core 1.0
Entity Framework Core 1.0Entity Framework Core 1.0
Entity Framework Core 1.0
 
Modern javascript
Modern javascriptModern javascript
Modern javascript
 
Building Modern Web Applications with ASP.NET5
Building Modern Web Applications with ASP.NET5Building Modern Web Applications with ASP.NET5
Building Modern Web Applications with ASP.NET5
 
Asp.net
Asp.netAsp.net
Asp.net
 
Building rest services using aspnetwebapi
Building rest services using aspnetwebapiBuilding rest services using aspnetwebapi
Building rest services using aspnetwebapi
 
2011 - SharePoint + jQuery
2011 - SharePoint + jQuery2011 - SharePoint + jQuery
2011 - SharePoint + jQuery
 
JetvsAdf
JetvsAdfJetvsAdf
JetvsAdf
 
The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...
 
User-percieved performance
User-percieved performanceUser-percieved performance
User-percieved performance
 
IBM Domino Modernizing apps with Angularjs
IBM Domino Modernizing apps with AngularjsIBM Domino Modernizing apps with Angularjs
IBM Domino Modernizing apps with Angularjs
 
Single page application
Single page applicationSingle page application
Single page application
 
Stencil JS for Framework Free Web Components | Steven Zelek
Stencil JS for Framework Free Web Components | Steven ZelekStencil JS for Framework Free Web Components | Steven Zelek
Stencil JS for Framework Free Web Components | Steven Zelek
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6
 
Single page application
Single page applicationSingle page application
Single page application
 
Scaling Tech in Asia
Scaling Tech in AsiaScaling Tech in Asia
Scaling Tech in Asia
 
Gatsby intro
Gatsby introGatsby intro
Gatsby intro
 
single page application
single page applicationsingle page application
single page application
 
Getting SEO performance in Angular Meteor with ngmeta
Getting SEO performance in Angular Meteor with ngmetaGetting SEO performance in Angular Meteor with ngmeta
Getting SEO performance in Angular Meteor with ngmeta
 
React + Flux = Joy
React + Flux = JoyReact + Flux = Joy
React + Flux = Joy
 

Similar a React in 2018

An Angular developer moving to React
An Angular developer moving to ReactAn Angular developer moving to React
An Angular developer moving to ReactSouvik Basu
 
Learning React - I
Learning React - ILearning React - I
Learning React - IMitch Chen
 
Progressive Web Apps and React
Progressive Web Apps and ReactProgressive Web Apps and React
Progressive Web Apps and ReactMike Melusky
 
Salvatore Laisa - Da Angular a React - Un viaggio inaspettato
Salvatore Laisa - Da Angular a React - Un viaggio inaspettatoSalvatore Laisa - Da Angular a React - Un viaggio inaspettato
Salvatore Laisa - Da Angular a React - Un viaggio inaspettatoCodemotion
 
Drew madelung sp designer workflows - sp-biz
Drew madelung   sp designer workflows - sp-bizDrew madelung   sp designer workflows - sp-biz
Drew madelung sp designer workflows - sp-bizDrew Madelung
 
Introduction to react native with redux
Introduction to react native with reduxIntroduction to react native with redux
Introduction to react native with reduxMike Melusky
 
My Resume_Uday -
My Resume_Uday -My Resume_Uday -
My Resume_Uday -Uday Kiran
 
Comparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAsComparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAsJennifer Estrada
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Derek Jacoby
 
SharePoint Designer Workflows - Nuts, Bolts and Examples
SharePoint Designer Workflows - Nuts, Bolts and ExamplesSharePoint Designer Workflows - Nuts, Bolts and Examples
SharePoint Designer Workflows - Nuts, Bolts and ExamplesDrew Madelung
 
Suguk Southampton CodePlex - March 2014
Suguk Southampton   CodePlex - March 2014Suguk Southampton   CodePlex - March 2014
Suguk Southampton CodePlex - March 2014Steven Andrews
 
How we built a job board in one week with JHipster
How we built a job board in one week with JHipsterHow we built a job board in one week with JHipster
How we built a job board in one week with JHipsterKile Niklawski
 
How we built a job board in one week with JHipster - @KileNiklawski @IpponUSA
How we built a job board in one week with JHipster - @KileNiklawski @IpponUSAHow we built a job board in one week with JHipster - @KileNiklawski @IpponUSA
How we built a job board in one week with JHipster - @KileNiklawski @IpponUSAKile Niklawski
 
Sumit_SharePoint
Sumit_SharePointSumit_SharePoint
Sumit_SharePointSumit Y
 
Mobile Website or Responsive Design? The Answer is NEITHER.
Mobile Website or Responsive Design? The Answer is NEITHER.Mobile Website or Responsive Design? The Answer is NEITHER.
Mobile Website or Responsive Design? The Answer is NEITHER.TWG
 
Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...
Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...
Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...FITC
 

Similar a React in 2018 (20)

An Angular developer moving to React
An Angular developer moving to ReactAn Angular developer moving to React
An Angular developer moving to React
 
React.js at Cortex
React.js at CortexReact.js at Cortex
React.js at Cortex
 
Learning React - I
Learning React - ILearning React - I
Learning React - I
 
Progressive Web Apps and React
Progressive Web Apps and ReactProgressive Web Apps and React
Progressive Web Apps and React
 
Salvatore Laisa - Da Angular a React - Un viaggio inaspettato
Salvatore Laisa - Da Angular a React - Un viaggio inaspettatoSalvatore Laisa - Da Angular a React - Un viaggio inaspettato
Salvatore Laisa - Da Angular a React - Un viaggio inaspettato
 
Drew madelung sp designer workflows - sp-biz
Drew madelung   sp designer workflows - sp-bizDrew madelung   sp designer workflows - sp-biz
Drew madelung sp designer workflows - sp-biz
 
React js
React jsReact js
React js
 
Introduction to react native with redux
Introduction to react native with reduxIntroduction to react native with redux
Introduction to react native with redux
 
My Resume_Uday -
My Resume_Uday -My Resume_Uday -
My Resume_Uday -
 
Comparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAsComparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAs
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
 
SharePoint Designer Workflows - Nuts, Bolts and Examples
SharePoint Designer Workflows - Nuts, Bolts and ExamplesSharePoint Designer Workflows - Nuts, Bolts and Examples
SharePoint Designer Workflows - Nuts, Bolts and Examples
 
Resume
ResumeResume
Resume
 
Suguk Southampton CodePlex - March 2014
Suguk Southampton   CodePlex - March 2014Suguk Southampton   CodePlex - March 2014
Suguk Southampton CodePlex - March 2014
 
How we built a job board in one week with JHipster
How we built a job board in one week with JHipsterHow we built a job board in one week with JHipster
How we built a job board in one week with JHipster
 
How we built a job board in one week with JHipster - @KileNiklawski @IpponUSA
How we built a job board in one week with JHipster - @KileNiklawski @IpponUSAHow we built a job board in one week with JHipster - @KileNiklawski @IpponUSA
How we built a job board in one week with JHipster - @KileNiklawski @IpponUSA
 
Sumit_SharePoint
Sumit_SharePointSumit_SharePoint
Sumit_SharePoint
 
Mobile Website or Responsive Design? The Answer is NEITHER.
Mobile Website or Responsive Design? The Answer is NEITHER.Mobile Website or Responsive Design? The Answer is NEITHER.
Mobile Website or Responsive Design? The Answer is NEITHER.
 
Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...
Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...
Should I Build a Separate Mobile Site or a Responsive Site? Neither! with Der...
 
2012.10 Oldfield
2012.10 Oldfield2012.10 Oldfield
2012.10 Oldfield
 

Último

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Último (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

React in 2018

  • 1. React in 2018 by Michael Yagudaev
  • 2. About Michael • Co-Founder @ Nano 3 Labs & PictureThat • Full-stack Developer Rails/React • Been working with React since 2014 • Web dev since 2001 • Passionate about AR • Fun Fact: Snowboarding is my freedom
  • 3. Outline • The Web Before React • The History of React • Lessons We Learned • Our hope for a better tomorrow
  • 5. React is Born! • In May 2013, Facebook brought us React • Idea for Virtual DOM came from Doom 3 Engine • Based on solid Computer Science design principles: • Composition • Encapsulation • Unidirectional dependency
  • 6. Flux Architecture • In 2014 Facebook introduced us to Flux • Solved the problem of State management on a global (application) level
  • 7. Redux is Born • In 2015 Dan Abramov introduced us to Redux • Inspired by Flux and Elm • Single store architecture • Composable reducers • Focus on immutable data
  • 8. Create React App is Born • In 2016 we got a zero-config, official way to start a react project • Comes with • Webpack • Jest Test framework • ES6 • ESLint
  • 9. 2017 • Static Typing became important: TypeScript • GraphQL as Replacement of REST +
  • 10. 2018? • Let’s switch gears… • What else do we need to create a real app? • beyond create-react-app • Is it really zero-config? • wait, where is the server in all of this?
  • 11. Apps We Want to Build • Single Page Applications • Responsive User Interface • Easy for new developers to work with • Extendable beyond browser, native desktop, mobile, etc • Fault tolerant (i.e. less bugs)
  • 12. Let’s add the usual suspects • Add eslint-config-standard • Add React Router • Add Redux • Easy to do, just go to README and follow instructions • Still… it takes time… :(
  • 13. What about CSS? • CSS is global scope, not great • It is often used for state level changes (:hover, :visited, .active) • We need something better • inline-styles are great, but there are better things: • JSS or Styled Components • See Material UI @ 1.0.0 for e.g.
  • 14. How do we get data? users posts Server comments users posts Client comments normalized normalized REACT UI REST/GraphQL Http Http denormalized Post 1 by John Doe 4 Comments Post 2 by John Doe 7 Comments Http new sync
  • 15. How does it look like in Redux? { users: { items: { 1: { id: 1, name: 'Bob Smith', ... } ... }, meta: { fetching: false, errors: [] } } posts: { items: { 1: { id: 1, userId: 1, comments: [1, 2, 3] } }, ... }, comments: { ... } }
  • 16. Redux (cont’d) // actions/users.js import { fetch } from 'fetch-redux-crud' export const fetchUsers = _ => dispatch => dispatch(fetch('users', { path: 'users' })) // reducers/users.js import { reducersFor } from 'fetch-redux-crud' export default reducersFor('users')
  • 17. Redux (cont’d) // selectors/users.js import values from 'lodash/values' const getUsers = (state) => values(state.users.items) const getUsersById = (state) => state.users.items // e.g. getUsersById(state)[2]
  • 18. Where do you denormalize? • Denormalize inside of selectors • Before passing down to React • Remember, keep the # of containers in the app low
  • 19. Tips for using APIs • Take only what you need (easier with GraphQL) • Go through a single entry point e.g.`/lib/api.js` • Keep it DRY, just because it is Redux • look at `redux-crud` library • Develop a naming convention for selectors • Use React 16 Error Boundaries
  • 20. File Structure ./src actions/ components/ routes/ containers/ routes/ lib/ reducers/ selectors/ services/ <- optional styles/ <- theme index.js <- entry point ./tests structure by type, than by feature
  • 21. Wish List • End-to-End Testing Framework • create-react-app option to run a full-setup with redux out-of-the-box • Generators • Library authors creating Test Helpers
  • 22. Questions? • twitter: @yagudaev, @nano3labs • P.S. We’re Hiring…