SlideShare a Scribd company logo
1 of 19
React JS
This Guy 
• Software Engineer at feature[23] 
• I can haz degrees in muzak and puterz 
• I beer, fish, and party on guitars 
• I currently dig FRP, IOT, and JS (the good parts…)
So, What Is React? 
• A JavaScript library for building User Interfaces* 
• It was created by the engineering team at facebook 
• https://code.facebook.com/projects/ 
• A (Smart) View Engine of sorts 
• It is not a client-side, MVC/MVVM/MW*, framework
What Does React Do? 
• React renders your UI 
• React responds to user interactions 
• React reduces complexity 
• React tackles performance issues for you, behind the scenes
This Sounds Familiar 
• It is… and isn’t 
• http://www.todomvc.com 
• Two-way data binding is great… and isn’t 
• Cascading effects and interdependent data 
• State over time 
• Templates are great… until they aren’t 
• Constrained Template Engines/Languages 
• Cohesion over Coupling 
• Templates don’t respect state 
• Frameworks are great… and aren’t 
• Just a View Engine, and just JavaScript 
• Truly reusable and plays nicely with existing frameworks and libraries 
• No esoteric concepts
React Concepts Notions 
• Components 
• Manage their own state 
• Handle interactions through explicit and declarative events 
• Separate responsibilities 
• Higher maintainability 
• Great for debugging 
• Great for testing 
• Props 
• Data that is passed to a component 
• Immutable 
• State 
• Immutable… sort of 
• this.setState() 
• “Re-render” entire app on state change 
• This sounds horribly inefficient… 
No esoteric concepts?!?! 
…these aren’t new concepts
Virtual DOM 
(this is) 
• A virtual, in memory, representation of the real DOM 
• Changes in the real DOM trigger changes to the state of your React 
Component 
• When state changes, React creates a new representation of the virtual 
DOM based on what has changed. 
• React diffs between the original representation and the new 
representation of the Virtual DOM. 
• React determines the minimal set of operations necessary to update the 
real DOM and batch processes them as a patch to the real DOM. 
• In effect, you have “re-rendered” your application, but you haven’t lost any 
state in the real DOM (scroll position, timers, etc.)
Why a Virtual DOM? 
• Because the real DOM is slow and clunky 
• …and you don’t know all the implications of changing DOM or Style 
• http://www.csstriggers.com 
• Because “re-rendering” your entire application every time state changes would be unbelievably slow (a la 
1990s style page refreshes) in the modern web. 
• But those 90s people had some things right 
• Wrapping state around a stateless protocol is...  
• Diffing Immutable Data Structures is fast 
• http://en.wikipedia.org/wiki/Hash_array_mapped_trie 
• You only update the path/parts that changed 
• Browser Compatibility and Normalization 
• Fix all the things! (that the DOM is horrible at)
Heuristics 
• Accepted rules to allow for O(N) diffing computation 
• Versus O(N3) 
• Keys 
• Seriously, a lack of keys will cause crazy behavior 
• Without keys, React won’t be able to know about dynamic DOM updates 
• Single Node 
• Components must return a single node 
• Can return any number of nodes within that 
• Use parentheses (just do it) 
• Component Levels 
• Components should never move vertically
JSX 
• Completely Optional 
• XML-usg syntactic sugar 
• Easier to reason about for engineers 
• Easier for designers to contribute 
• Give it a try
JSX
JSX
Gotchas 
• Including JSX Transformer 
• <script type=“text/jsx”></script> 
• <div style={wtf}></div> 
• <div className={wtf}></div> 
• ClassSet makes up for this annoyance 
• Components must return a single element 
• Auto-binding of this and closures 
• KEYS 
• Seriously, these are crucial 
• Must be unique
Why Use It? 
• Portable/Agnostic 
• Performance 
• Maintenance 
• Comprehensible 
• Testable
Demo
Resources 
• YouTubez 
• David Nolen: Immutability, Interactivity, and JavaScript 
• Tom Occhino and Jordan Walke: Introduction to ReactJS 
• Pete Hunt: Rethinking Best Practices 
• Steven Luscher: Developing User Interfaces with ReactJS 
• Just look up ‘ReactJS’ on YouTube, there are some other great videos 
• Links 
• ReactJS 
• ReactJS.NET 
• Flux 
• Virtual DOM
Flux
ReactJS Code Impact

More Related Content

What's hot

How NOT to get lost in the current JavaScript landscape
How NOT to get lost in the current JavaScript landscapeHow NOT to get lost in the current JavaScript landscape
How NOT to get lost in the current JavaScript landscapeRadosław Scheibinger
 
Increasing performance with Elixir Tasks
Increasing performance with Elixir TasksIncreasing performance with Elixir Tasks
Increasing performance with Elixir TasksJeffrey Chan
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6Rob Eisenberg
 
Understanding Redux — Ilya Gelman
Understanding Redux — Ilya GelmanUnderstanding Redux — Ilya Gelman
Understanding Redux — Ilya Gelman500Tech
 
Understanding Facebook's React.js
Understanding Facebook's React.jsUnderstanding Facebook's React.js
Understanding Facebook's React.jsFederico Torre
 
[CocoaHeads Tricity] Michał Zygar - Consuming API
[CocoaHeads Tricity] Michał Zygar - Consuming API[CocoaHeads Tricity] Michał Zygar - Consuming API
[CocoaHeads Tricity] Michał Zygar - Consuming APICocoaHeads Tricity
 
React Native Introduction: Making Real iOS and Android Mobile App By JavaScript
React Native Introduction: Making Real iOS and Android Mobile App By JavaScriptReact Native Introduction: Making Real iOS and Android Mobile App By JavaScript
React Native Introduction: Making Real iOS and Android Mobile App By JavaScriptKobkrit Viriyayudhakorn
 
Server side rendering for any JS framework
Server side rendering for any JS frameworkServer side rendering for any JS framework
Server side rendering for any JS frameworkAdam L Barrett
 
Breaking the Server-Client Divide with Node.js and React
Breaking the Server-Client Divide with Node.js and ReactBreaking the Server-Client Divide with Node.js and React
Breaking the Server-Client Divide with Node.js and ReactDejan Glozic
 
From Imperative to Functional Programming (for Absolute Beginners)
From Imperative to Functional Programming (for Absolute Beginners)From Imperative to Functional Programming (for Absolute Beginners)
From Imperative to Functional Programming (for Absolute Beginners)Alex Bunardzic
 
Developing, building, testing and deploying react native apps
Developing, building, testing and deploying react native appsDeveloping, building, testing and deploying react native apps
Developing, building, testing and deploying react native appsLeena N
 
Akka - Developing SEDA Based Applications
Akka - Developing SEDA Based ApplicationsAkka - Developing SEDA Based Applications
Akka - Developing SEDA Based ApplicationsBenjamin Darfler
 
NTBT #1 "Client-Side JavaScript"
NTBT #1 "Client-Side JavaScript"NTBT #1 "Client-Side JavaScript"
NTBT #1 "Client-Side JavaScript"Frédéric Ghilini
 
Dynamic input tables lwc vs aura vs. visualforce
Dynamic input tables  lwc vs aura vs. visualforceDynamic input tables  lwc vs aura vs. visualforce
Dynamic input tables lwc vs aura vs. visualforceMike Tetlow
 
Vlad zelinschi optimizing the critical rendering path
Vlad zelinschi   optimizing the critical rendering pathVlad zelinschi   optimizing the critical rendering path
Vlad zelinschi optimizing the critical rendering pathCodecamp Romania
 
Kevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptKevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptAxway Appcelerator
 

What's hot (20)

How NOT to get lost in the current JavaScript landscape
How NOT to get lost in the current JavaScript landscapeHow NOT to get lost in the current JavaScript landscape
How NOT to get lost in the current JavaScript landscape
 
Increasing performance with Elixir Tasks
Increasing performance with Elixir TasksIncreasing performance with Elixir Tasks
Increasing performance with Elixir Tasks
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6
 
Understanding Redux — Ilya Gelman
Understanding Redux — Ilya GelmanUnderstanding Redux — Ilya Gelman
Understanding Redux — Ilya Gelman
 
Angular2 vs React
Angular2 vs ReactAngular2 vs React
Angular2 vs React
 
Understanding Facebook's React.js
Understanding Facebook's React.jsUnderstanding Facebook's React.js
Understanding Facebook's React.js
 
[CocoaHeads Tricity] Michał Zygar - Consuming API
[CocoaHeads Tricity] Michał Zygar - Consuming API[CocoaHeads Tricity] Michał Zygar - Consuming API
[CocoaHeads Tricity] Michał Zygar - Consuming API
 
React Native Introduction: Making Real iOS and Android Mobile App By JavaScript
React Native Introduction: Making Real iOS and Android Mobile App By JavaScriptReact Native Introduction: Making Real iOS and Android Mobile App By JavaScript
React Native Introduction: Making Real iOS and Android Mobile App By JavaScript
 
Server side rendering for any JS framework
Server side rendering for any JS frameworkServer side rendering for any JS framework
Server side rendering for any JS framework
 
React introduction
React introductionReact introduction
React introduction
 
Breaking the Server-Client Divide with Node.js and React
Breaking the Server-Client Divide with Node.js and ReactBreaking the Server-Client Divide with Node.js and React
Breaking the Server-Client Divide with Node.js and React
 
From Imperative to Functional Programming (for Absolute Beginners)
From Imperative to Functional Programming (for Absolute Beginners)From Imperative to Functional Programming (for Absolute Beginners)
From Imperative to Functional Programming (for Absolute Beginners)
 
Developing, building, testing and deploying react native apps
Developing, building, testing and deploying react native appsDeveloping, building, testing and deploying react native apps
Developing, building, testing and deploying react native apps
 
Munchkin
MunchkinMunchkin
Munchkin
 
Akka - Developing SEDA Based Applications
Akka - Developing SEDA Based ApplicationsAkka - Developing SEDA Based Applications
Akka - Developing SEDA Based Applications
 
NTBT #1 "Client-Side JavaScript"
NTBT #1 "Client-Side JavaScript"NTBT #1 "Client-Side JavaScript"
NTBT #1 "Client-Side JavaScript"
 
Hello world - intro to node js
Hello world - intro to node jsHello world - intro to node js
Hello world - intro to node js
 
Dynamic input tables lwc vs aura vs. visualforce
Dynamic input tables  lwc vs aura vs. visualforceDynamic input tables  lwc vs aura vs. visualforce
Dynamic input tables lwc vs aura vs. visualforce
 
Vlad zelinschi optimizing the critical rendering path
Vlad zelinschi   optimizing the critical rendering pathVlad zelinschi   optimizing the critical rendering path
Vlad zelinschi optimizing the critical rendering path
 
Kevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptKevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScript
 

Similar to ReactJS Code Impact

Introduction to react native with redux
Introduction to react native with reduxIntroduction to react native with redux
Introduction to react native with reduxMike Melusky
 
React.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UIReact.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UIMarcin Grzywaczewski
 
Learning React - I
Learning React - ILearning React - I
Learning React - IMitch Chen
 
Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016Marco Breveglieri
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Jeremy Likness
 
React + Mobile
React + MobileReact + Mobile
React + Mobileantriss
 
React js TRAINING IN BANGALORE
React js TRAINING IN BANGALOREReact js TRAINING IN BANGALORE
React js TRAINING IN BANGALOREnearlearn
 
React js TRAINING IN BANGALORE
React js TRAINING IN BANGALOREReact js TRAINING IN BANGALORE
React js TRAINING IN BANGALOREnearlearn
 
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer ReplacementMidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer ReplacementZach Lendon
 
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)Zach Lendon
 
l1-reactnativeintroduction-160816150540.pdf
l1-reactnativeintroduction-160816150540.pdfl1-reactnativeintroduction-160816150540.pdf
l1-reactnativeintroduction-160816150540.pdfHương Trà Pé Xjnk
 
Microservices: The Best Practices
Microservices: The Best PracticesMicroservices: The Best Practices
Microservices: The Best PracticesPavel Mička
 
An evening with React Native
An evening with React NativeAn evening with React Native
An evening with React NativeMike Melusky
 
Wessel Loth - Fire your Frontend Framework with Lit - TEQnation 2022.pdf
Wessel Loth - Fire your Frontend Framework with Lit - TEQnation 2022.pdfWessel Loth - Fire your Frontend Framework with Lit - TEQnation 2022.pdf
Wessel Loth - Fire your Frontend Framework with Lit - TEQnation 2022.pdfWessel Loth
 

Similar to ReactJS Code Impact (20)

React Tech Salon
React Tech SalonReact Tech Salon
React Tech Salon
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
Introduction to react native with redux
Introduction to react native with reduxIntroduction to react native with redux
Introduction to react native with redux
 
React.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UIReact.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UI
 
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
 
Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016
 
Meteor + React
Meteor + ReactMeteor + React
Meteor + React
 
React js
React jsReact js
React js
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!
 
React101 v3
React101 v3React101 v3
React101 v3
 
React + Mobile
React + MobileReact + Mobile
React + Mobile
 
React js TRAINING IN BANGALORE
React js TRAINING IN BANGALOREReact js TRAINING IN BANGALORE
React js TRAINING IN BANGALORE
 
React js TRAINING IN BANGALORE
React js TRAINING IN BANGALOREReact js TRAINING IN BANGALORE
React js TRAINING IN BANGALORE
 
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer ReplacementMidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
 
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
 
l1-reactnativeintroduction-160816150540.pdf
l1-reactnativeintroduction-160816150540.pdfl1-reactnativeintroduction-160816150540.pdf
l1-reactnativeintroduction-160816150540.pdf
 
Microservices: The Best Practices
Microservices: The Best PracticesMicroservices: The Best Practices
Microservices: The Best Practices
 
An evening with React Native
An evening with React NativeAn evening with React Native
An evening with React Native
 
Wessel Loth - Fire your Frontend Framework with Lit - TEQnation 2022.pdf
Wessel Loth - Fire your Frontend Framework with Lit - TEQnation 2022.pdfWessel Loth - Fire your Frontend Framework with Lit - TEQnation 2022.pdf
Wessel Loth - Fire your Frontend Framework with Lit - TEQnation 2022.pdf
 

Recently uploaded

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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
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
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 

Recently uploaded (20)

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
 
+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...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

ReactJS Code Impact

  • 2. This Guy • Software Engineer at feature[23] • I can haz degrees in muzak and puterz • I beer, fish, and party on guitars • I currently dig FRP, IOT, and JS (the good parts…)
  • 3. So, What Is React? • A JavaScript library for building User Interfaces* • It was created by the engineering team at facebook • https://code.facebook.com/projects/ • A (Smart) View Engine of sorts • It is not a client-side, MVC/MVVM/MW*, framework
  • 4. What Does React Do? • React renders your UI • React responds to user interactions • React reduces complexity • React tackles performance issues for you, behind the scenes
  • 5. This Sounds Familiar • It is… and isn’t • http://www.todomvc.com • Two-way data binding is great… and isn’t • Cascading effects and interdependent data • State over time • Templates are great… until they aren’t • Constrained Template Engines/Languages • Cohesion over Coupling • Templates don’t respect state • Frameworks are great… and aren’t • Just a View Engine, and just JavaScript • Truly reusable and plays nicely with existing frameworks and libraries • No esoteric concepts
  • 6. React Concepts Notions • Components • Manage their own state • Handle interactions through explicit and declarative events • Separate responsibilities • Higher maintainability • Great for debugging • Great for testing • Props • Data that is passed to a component • Immutable • State • Immutable… sort of • this.setState() • “Re-render” entire app on state change • This sounds horribly inefficient… No esoteric concepts?!?! …these aren’t new concepts
  • 7. Virtual DOM (this is) • A virtual, in memory, representation of the real DOM • Changes in the real DOM trigger changes to the state of your React Component • When state changes, React creates a new representation of the virtual DOM based on what has changed. • React diffs between the original representation and the new representation of the Virtual DOM. • React determines the minimal set of operations necessary to update the real DOM and batch processes them as a patch to the real DOM. • In effect, you have “re-rendered” your application, but you haven’t lost any state in the real DOM (scroll position, timers, etc.)
  • 8. Why a Virtual DOM? • Because the real DOM is slow and clunky • …and you don’t know all the implications of changing DOM or Style • http://www.csstriggers.com • Because “re-rendering” your entire application every time state changes would be unbelievably slow (a la 1990s style page refreshes) in the modern web. • But those 90s people had some things right • Wrapping state around a stateless protocol is...  • Diffing Immutable Data Structures is fast • http://en.wikipedia.org/wiki/Hash_array_mapped_trie • You only update the path/parts that changed • Browser Compatibility and Normalization • Fix all the things! (that the DOM is horrible at)
  • 9. Heuristics • Accepted rules to allow for O(N) diffing computation • Versus O(N3) • Keys • Seriously, a lack of keys will cause crazy behavior • Without keys, React won’t be able to know about dynamic DOM updates • Single Node • Components must return a single node • Can return any number of nodes within that • Use parentheses (just do it) • Component Levels • Components should never move vertically
  • 10. JSX • Completely Optional • XML-usg syntactic sugar • Easier to reason about for engineers • Easier for designers to contribute • Give it a try
  • 11. JSX
  • 12. JSX
  • 13. Gotchas • Including JSX Transformer • <script type=“text/jsx”></script> • <div style={wtf}></div> • <div className={wtf}></div> • ClassSet makes up for this annoyance • Components must return a single element • Auto-binding of this and closures • KEYS • Seriously, these are crucial • Must be unique
  • 14. Why Use It? • Portable/Agnostic • Performance • Maintenance • Comprehensible • Testable
  • 15. Demo
  • 16.
  • 17. Resources • YouTubez • David Nolen: Immutability, Interactivity, and JavaScript • Tom Occhino and Jordan Walke: Introduction to ReactJS • Pete Hunt: Rethinking Best Practices • Steven Luscher: Developing User Interfaces with ReactJS • Just look up ‘ReactJS’ on YouTube, there are some other great videos • Links • ReactJS • ReactJS.NET • Flux • Virtual DOM
  • 18. Flux

Editor's Notes

  1. JavaScript Library Created By Facebook =>It was open sourced in mid-2013 =>Currently at version 0.11.1 Smart View Engine =>Smart View Engine: Think “controller-views”, I know, that sounds awfully coupled, doesn’t it? What it is NOT =>Comparing React to Angular or Ember is like comparing apples and fruit markets (thanks reddit) *When I say large applications, I mean really large applications with rich user experiences, not just LOB applications that need some small JS widgets here and there. ? Who is currently maintaining a seriously large application with a metric shit ton of JavaScript? You may want to consider React.
  2. React Renders your UI React presents what your View should look like at a given point in time React Responds to User Interactions =>And responds to user interactions. Think of it as a more declarative jQuery. =>Prevents unwanted state Reduces Complexity =>React encourages you to write Components with SRP in mind, versus writing a bunch of spaghetti JavaScript and trying to mitigate changes in data over time. Performance =>React has a ton of performance benefits that you get for free, I’ll discuss these in depth a bit later
  3. There are a lot of client-side JS frameworks… a lot Two Way Data Binding Two way data-binding isn’t always a bad thing, it has its place, like everything else But JavaScript is based on the von Neumann model of computing, meaning data only flows in one direction You assign values right to left. Building a two-way data binding abstraction fights this aspect of the language It also makes it more difficult to reason about the program, since data flies in and out modules in multiple directions And performance is hard to think about with regard to cascading updates When it works, 2-way data binding is great, when it doesn’t, it’s difficult to deal with. React does have two way data binding (of sorts) if you want it Templating You’re handcuffed by whatever your Template Engine of choice provides to you With React, you have the full arsenal of JS at your disposal to decide how your data should be rendered Templates aren’t really separating concerns, but technologies You’re already on the client, you’re in the View You write JavaScript, or use JS frameworks to manipulate HTML, so you’re writing JS-based display logic, hence, it’s a View/Display concern React favors and accepts this level of coupling because it’s inherently cohesive for your JS and Display Logic to live together After all, JS was written to work with the browser. You know, that thing that presents your View… Frameworks Because React is a library, and it is written to be truly agnostic, you can use it with any existing framework (or your own implementation) All it cares about is rendering data Many frameworks contain specialized concepts that engineers have to learn and deal with in order to make their underlying implementation work. There are a lot of leaky abstractions in these frameworks React has one leaky abstraction
  4. ***These aren’t esoteric, as they are nothing new in terms of programming concepts*** Components Think of the events as a more declarative jQuery If you find yourself heaping too much responsibility into a Component, create a new one Should model the hierarchy of your data Props Simply put, props are the data you want to render, typically passed in from the server or an external service Should be treated as an immutable data structure State State should also be thought of as immutable, but state will change through calls to this.setState() You pass in what the new state of the object should be, and your component will re-render itself with the new state/data Sounds horribly inefficient, right? Virtual DOM
  5. Virtual DOM This is a new concept, but you don’t really have to worry about it, learn about it, or know anything about it outside of a basic understanding of what it’s doing for you. And honestly, if you don’t know what the DOM is, and can’t discern what a virtual DOM is, maybe you shouldn’t be doing this…
  6. You need to include the JSXTransformer.js along with the react.js file in order to develop with JSX text/jsx for JSX based script Should compile to JS for deployment, see, React Compiler Inline styles are bad anyway, and you shouldn’t use them, but it’s not a horrible hindrance to use objects for style className is a minor inconvenience, but no big deal, classSet is an awesome add on Components should only ever return a single element (have to wrap everything) Keys are super important. They’re the way that dynamic elements are differentiated between renders, so when you’re diffing between renders and you have two collections, how would your collection determine where to place the new item(s)?