SlideShare une entreprise Scribd logo
1  sur  14
Télécharger pour lire hors ligne
Om & React.js
Kamil Toman (@katox)
Is React.js another NiH framework?
➔ Templates are underpowered
◆ Low power leads to new DSLs
◆ Poor composition
➔ Models are central to UIs
◆ View needs to be in sync with its model
➔ Setup bi-di binding and observe changes
◆ Observable models encourage mutation
◆ Mutation creates additional complexity
◆ Can’t use immutable data structures
React.js key features
➔ No templates
◆ Component objects
➔ No dirty checking
◆ Re-render the whole app on every update
◆ Diff the output not DOM
➔ No explicit DOM manipulation
◆ Virtual DOM and synthetic events
◆ Minimal set of changes computation
◆ Batch execution of all updates
Virtual DOM
➔ In-memory data structures
➔ Independent of browser’s DOM
➔ No string concatenation
➔ Optimised for CPU performance
➔ Optimized for memory footprint as well
Reading React JSX (1)
<div>inner</div>
<div>
<span>a</span>
<span>b</span>
</div>
React.DOM.div({}, ‘inner’);
React.DOM.div({},
[ React.DOM.span({},’a’),
React.DOM.span({},’b’) ]);
Reading React JSX (2)
<div id=”myId”>text</div>
var MyC =
React.createClass({/*...*/});
var tree =
<MyC><span /></MyC>;
React.DOM.div(
{ id: “myId” },
‘text’);
var MyC =
React.createClass({/*...*/});
var tree = MyC(null,
React.DOM.span(null);
Reading Om (1)
React.DOM.div(
{ id: “myId” },
‘text’);
React.DOM.div({},
[ React.DOM.span({},’a’),
React.DOM.span({},’b’) ]);
(dom/div #js { :id “myId” }
“text”)
(dom/div nil
(dom/span nil “a”)
(dom/span nil “b”))
Reading Om (2)
var CommentBox = React.
createClass(
{ render: function() {
return React.DOM.div(
{className: "cmBox"},
"I am a CommentBox");
}
});
(def CommentBox
(js/React.createClass
#js {:render (fn []
(this-as this
(js/React.DOM.div
#js {:className
“cmBox”}
“I am a CommentBox”
))))
Reading Om (3)
(def CommentBox
(js/React.createClass
#js {:render (fn []
(this-as this
(js/React.DOM.div
#js {:className
“cmBox”}
“I am a CommentBox”
))))
(defn CommentBox [app]
(om/component
(dom/div
#js {:className
“cmBox”}
“I am a CommentBox”)))
Reading Om (4)
(defn CommentBox [app]
(om/component
(dom/div
#js {:className
“cmBox”}
“I am a CommentBox”)))
(defn CommentBox [app]
(reify
om/IRender
(render [this]
(dom/div
#js {:className
“cmBox”}
“I am a CommentBox”)))
Into the Code - Clone Omlab!
https://github.com/katox/omlab
What To See
➔ React: Rethinking best practices
➔ Introduction to React.js
➔ High performance functional programming
with React and Meteor
➔ React Developer Tools
➔ React.js Components
Thanks for your attention!

Contenu connexe

Tendances

GR8Conf 2011: Tuning Grails Applications by Peter Ledbrook
GR8Conf 2011: Tuning Grails Applications by Peter LedbrookGR8Conf 2011: Tuning Grails Applications by Peter Ledbrook
GR8Conf 2011: Tuning Grails Applications by Peter Ledbrook
GR8Conf
 
kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High load
Krivoy Rog IT Community
 

Tendances (19)

State management in react applications (Statecharts)
State management in react applications (Statecharts)State management in react applications (Statecharts)
State management in react applications (Statecharts)
 
Introduction to Nodejs and Isomorphic javascript
Introduction to Nodejs and Isomorphic javascriptIntroduction to Nodejs and Isomorphic javascript
Introduction to Nodejs and Isomorphic javascript
 
SQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query PerformanceSQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query Performance
 
Three Lessons about Gatling and Microservices
Three Lessons about Gatling and MicroservicesThree Lessons about Gatling and Microservices
Three Lessons about Gatling and Microservices
 
Database testing tutorial
Database testing tutorialDatabase testing tutorial
Database testing tutorial
 
Frost - W3C Mobile Ajax Workshop 2007
Frost - W3C Mobile Ajax Workshop 2007Frost - W3C Mobile Ajax Workshop 2007
Frost - W3C Mobile Ajax Workshop 2007
 
FAULT TOLERANCE
FAULT TOLERANCEFAULT TOLERANCE
FAULT TOLERANCE
 
Single Page Apps
Single Page AppsSingle Page Apps
Single Page Apps
 
Sql server performance tuning and optimization
Sql server performance tuning and optimizationSql server performance tuning and optimization
Sql server performance tuning and optimization
 
Functional reactive programming
Functional reactive programmingFunctional reactive programming
Functional reactive programming
 
Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"
 
GR8Conf 2011: Tuning Grails Applications by Peter Ledbrook
GR8Conf 2011: Tuning Grails Applications by Peter LedbrookGR8Conf 2011: Tuning Grails Applications by Peter Ledbrook
GR8Conf 2011: Tuning Grails Applications by Peter Ledbrook
 
In Memory Unit Testing with Apache DbUnit
In Memory Unit Testing with Apache DbUnitIn Memory Unit Testing with Apache DbUnit
In Memory Unit Testing with Apache DbUnit
 
Introduction to VB
Introduction to VBIntroduction to VB
Introduction to VB
 
kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High load
 
No sql (not only sql)
No sql                 (not only sql)No sql                 (not only sql)
No sql (not only sql)
 
What Are Your Servers Doing While You’re Sleeping?
What Are Your Servers Doing While You’re Sleeping?What Are Your Servers Doing While You’re Sleeping?
What Are Your Servers Doing While You’re Sleeping?
 
Jms queue
Jms queueJms queue
Jms queue
 
Mirroring in SQL Server 2012 R2
Mirroring in SQL Server 2012 R2Mirroring in SQL Server 2012 R2
Mirroring in SQL Server 2012 R2
 

En vedette

Pbl group 9 a
Pbl group 9 aPbl group 9 a
Pbl group 9 a
miezy1989
 
Mathematics Anxiety
Mathematics AnxietyMathematics Anxiety
Mathematics Anxiety
miezy1989
 
Pbl group 9 a
Pbl group 9 aPbl group 9 a
Pbl group 9 a
miezy1989
 
Las increibles historias de don quijote y sancho panza
Las increibles historias de don quijote y sancho panzaLas increibles historias de don quijote y sancho panza
Las increibles historias de don quijote y sancho panza
maribel rios
 
Fantom - Programming Language for JVM, CLR, and Javascript
Fantom - Programming Language for JVM, CLR, and JavascriptFantom - Programming Language for JVM, CLR, and Javascript
Fantom - Programming Language for JVM, CLR, and Javascript
Kamil Toman
 
Kelayakan Guru
Kelayakan GuruKelayakan Guru
Kelayakan Guru
miezy1989
 
Kelayakan Guru
Kelayakan GuruKelayakan Guru
Kelayakan Guru
miezy1989
 

En vedette (12)

Presentation2
Presentation2Presentation2
Presentation2
 
Presentation2
Presentation2Presentation2
Presentation2
 
Pbl group 9 a
Pbl group 9 aPbl group 9 a
Pbl group 9 a
 
Mathematics Anxiety
Mathematics AnxietyMathematics Anxiety
Mathematics Anxiety
 
Pbl group 9 a
Pbl group 9 aPbl group 9 a
Pbl group 9 a
 
Портфоліо викладача та студента . Педагогічні аспекти
Портфоліо викладача та студента. Педагогічні аспектиПортфоліо викладача та студента. Педагогічні аспекти
Портфоліо викладача та студента . Педагогічні аспекти
 
UW Presentation - Matt Law - Apr 2016
UW Presentation - Matt Law - Apr 2016UW Presentation - Matt Law - Apr 2016
UW Presentation - Matt Law - Apr 2016
 
Las increibles historias de don quijote y sancho panza
Las increibles historias de don quijote y sancho panzaLas increibles historias de don quijote y sancho panza
Las increibles historias de don quijote y sancho panza
 
Fantom - Programming Language for JVM, CLR, and Javascript
Fantom - Programming Language for JVM, CLR, and JavascriptFantom - Programming Language for JVM, CLR, and Javascript
Fantom - Programming Language for JVM, CLR, and Javascript
 
Kelayakan Guru
Kelayakan GuruKelayakan Guru
Kelayakan Guru
 
Acl1r lligada abc
Acl1r lligada abcAcl1r lligada abc
Acl1r lligada abc
 
Kelayakan Guru
Kelayakan GuruKelayakan Guru
Kelayakan Guru
 

Similaire à Om & React.js

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
SHAIKIRFAN715544
 
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
jobinThomas54
 
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
codebits
 

Similaire à Om & React.js (20)

Module Architecture of React-Redux Applications
Module Architecture of React-Redux ApplicationsModule Architecture of React-Redux Applications
Module Architecture of React-Redux Applications
 
Robust web apps with React.js
Robust web apps with React.jsRobust web apps with React.js
Robust web apps with React.js
 
Incremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend DevelopmentIncremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend Development
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practices
 
React & redux
React & reduxReact & redux
React & redux
 
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
 
Intro to Databases
Intro to DatabasesIntro to Databases
Intro to Databases
 
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
 
ReactJS - A quick introduction to Awesomeness
ReactJS - A quick introduction to AwesomenessReactJS - A quick introduction to Awesomeness
ReactJS - A quick introduction to Awesomeness
 
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
 
FRU Kathmandu: Adopting with Change Frontend Architecture and Patterns
FRU Kathmandu: Adopting with Change Frontend Architecture and PatternsFRU Kathmandu: Adopting with Change Frontend Architecture and Patterns
FRU Kathmandu: Adopting with Change Frontend Architecture and Patterns
 
Flux architecture and Redux - theory, context and practice
Flux architecture and Redux - theory, context and practiceFlux architecture and Redux - theory, context and practice
Flux architecture and Redux - theory, context and practice
 
JavaScript for Enterprise Applications
JavaScript for Enterprise ApplicationsJavaScript for Enterprise Applications
JavaScript for Enterprise Applications
 
Ad111
Ad111Ad111
Ad111
 
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
 
Meteor + React
Meteor + ReactMeteor + React
Meteor + React
 
2018 02-22 React, Redux & Building Applications that Scale | React
2018 02-22 React, Redux & Building Applications that Scale | React2018 02-22 React, Redux & Building Applications that Scale | React
2018 02-22 React, Redux & Building Applications that Scale | React
 
Introduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with ClojurescriptIntroduction to Functional Reactive Web with Clojurescript
Introduction to Functional Reactive Web with Clojurescript
 
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
 
DDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFrameworkDDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFramework
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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...
 
[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 🐘
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Om & React.js

  • 1. Om & React.js Kamil Toman (@katox)
  • 2. Is React.js another NiH framework? ➔ Templates are underpowered ◆ Low power leads to new DSLs ◆ Poor composition ➔ Models are central to UIs ◆ View needs to be in sync with its model ➔ Setup bi-di binding and observe changes ◆ Observable models encourage mutation ◆ Mutation creates additional complexity ◆ Can’t use immutable data structures
  • 3.
  • 4. React.js key features ➔ No templates ◆ Component objects ➔ No dirty checking ◆ Re-render the whole app on every update ◆ Diff the output not DOM ➔ No explicit DOM manipulation ◆ Virtual DOM and synthetic events ◆ Minimal set of changes computation ◆ Batch execution of all updates
  • 5. Virtual DOM ➔ In-memory data structures ➔ Independent of browser’s DOM ➔ No string concatenation ➔ Optimised for CPU performance ➔ Optimized for memory footprint as well
  • 6. Reading React JSX (1) <div>inner</div> <div> <span>a</span> <span>b</span> </div> React.DOM.div({}, ‘inner’); React.DOM.div({}, [ React.DOM.span({},’a’), React.DOM.span({},’b’) ]);
  • 7. Reading React JSX (2) <div id=”myId”>text</div> var MyC = React.createClass({/*...*/}); var tree = <MyC><span /></MyC>; React.DOM.div( { id: “myId” }, ‘text’); var MyC = React.createClass({/*...*/}); var tree = MyC(null, React.DOM.span(null);
  • 8. Reading Om (1) React.DOM.div( { id: “myId” }, ‘text’); React.DOM.div({}, [ React.DOM.span({},’a’), React.DOM.span({},’b’) ]); (dom/div #js { :id “myId” } “text”) (dom/div nil (dom/span nil “a”) (dom/span nil “b”))
  • 9. Reading Om (2) var CommentBox = React. createClass( { render: function() { return React.DOM.div( {className: "cmBox"}, "I am a CommentBox"); } }); (def CommentBox (js/React.createClass #js {:render (fn [] (this-as this (js/React.DOM.div #js {:className “cmBox”} “I am a CommentBox” ))))
  • 10. Reading Om (3) (def CommentBox (js/React.createClass #js {:render (fn [] (this-as this (js/React.DOM.div #js {:className “cmBox”} “I am a CommentBox” )))) (defn CommentBox [app] (om/component (dom/div #js {:className “cmBox”} “I am a CommentBox”)))
  • 11. Reading Om (4) (defn CommentBox [app] (om/component (dom/div #js {:className “cmBox”} “I am a CommentBox”))) (defn CommentBox [app] (reify om/IRender (render [this] (dom/div #js {:className “cmBox”} “I am a CommentBox”)))
  • 12. Into the Code - Clone Omlab! https://github.com/katox/omlab
  • 13. What To See ➔ React: Rethinking best practices ➔ Introduction to React.js ➔ High performance functional programming with React and Meteor ➔ React Developer Tools ➔ React.js Components
  • 14. Thanks for your attention!