SlideShare a Scribd company logo
18.08.2016
Fatih Şimşek - Software Infrastructure
React
React
Open source Javascript Library
Created by Jordan Walke, a software engineer at Facebook
First deployed on Facebook’s newsfeed in 2011
Maintained by Facebook, Instagram and a community of
individual developers and corporations
Who is using React?
9flats - Airbnb - Alipay - Atlassian - BBC - Box - Capital One -
Coursera -Dailymotion - Deezer - Docker - Expedia - Facebook -
Fotocasa - HappyFresh - IMDb - Instacart - Instagram - Khan
Academy - Klarna - Lyft - NBC - Netflix - NFL - Paypal - Periscope -
Ralph Lauren - Reddit – Salesforce - Sberbank - Stack Overflow -
Tesla - Tmall - The New York Times - Twitter Fabric - Twitter
Mobile - Uber - WhatsApp - Wired - Yahoo - Zendesk
https://github.com/facebook/react/wiki/Sites-Using-React
Github
React
Creating user interface(V in MVC model)
Speed
Declarative
Composable
Learn Once, Write Anywhere
Support ES6
Testable
Write once, Run Everywhere
React
Architecture
Architecture
Component manage own state
One way binding
JSX
Virtual DOM
Component Lifecycle
JSX
Supports xml-like syntax inline in JavaScript
Each element is transformed into a Javascript function call
• <Hello /> => Hello(null)
• <div /> => React.DOM.div(null)
Virtual DOM
Problem:
• DOM manipulation is expensive
• Touching DOM is hard to test
• Re-render all parts of DOM make your app slowly
Virtual DOM
Solution:
When the component’s state is changed, React
• Use different algorithm with the browser DOM tree to
identify the changes
• Instead of creating new object, React just identify what
change is took place and once identify update that state
• Render the subtree of DOM elements into the rendering of
the DOM
Virtual DOM
DEMO
Prop / State
Prop:
• Used to pass parameter from parent to children
• PropTypes used to validate properties
• getDefaultProps
State:
• Used to manage state inside component
• getInitialState
• setState
Prop / State
Mixins / Statics
Mixins:
• Different components may share some common functionality
• Several mixins can be defined
• Methods defined on mixins run in the order mixins were
listed
Statics:
• Like .Net / Java static method
• Define static methods in statics block of component
Events
componentWillMount: Invoked once before the initial render
componentDidMount: Invoked once, only on the client
componentWillReceiveProps: Invoked when a component is receiving new props
shouldComponentUpdate: Invoked before rendering when new props or state are
being received
componentWillUpdate: Invoked immediately before rendering when new props or
state are being received
componentDidUpdate: Invoked immediately after the component's updates are
flushed to the DOM
componentWillUnmount: Invoked immediately before a component is
unmounted from the DOM
Initial Phase
Lifecycle
Update Phase
DEMO
React JS
Flux
Action: Helper method that facilitate passing data
to the Dispatcher
Dispatcher: Receive action and broadcast
payload to registered callback
Store: Containers for application state & logic that
have callbacks registered to the dispatcher
View: State from Stores and pass it down via props
to child components
Flux
Redux
• Single source of truth
• State is read-only
• Mutations are written
as pure functions
(reducers)
Redux
• Important difference to Flux: no dispatching inside the action
• There is no Dispatcher at all; pure functions do not need to
be managed, they need to be composed
• Mutations are written as pure functions
Benchmark
React JS

More Related Content

PDF
Basics of React Hooks.pptx.pdf
PPTX
Understanding react hooks
PPTX
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
PPTX
React web development
PPTX
React js
PDF
Workshop 21: React Router
PPTX
React/Redux
PPTX
Basics of React Hooks.pptx.pdf
Understanding react hooks
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React web development
React js
Workshop 21: React Router
React/Redux

What's hot (20)

PPTX
React js programming concept
PPTX
Introduction to react_js
ODP
Introduction to ReactJS
PPTX
reactJS
PDF
ReactJS presentation
PPTX
Reactjs
PPTX
Intro to React
PPTX
Node.js Express
PPTX
Its time to React.js
PPTX
Introduction to React JS for beginners
PDF
React js
PPTX
PPTX
React workshop
PDF
Introduction to ReactJS
PPTX
Express js
PPTX
ReactJS presentation.pptx
PPTX
How native is React Native? | React Native vs Native App Development
PPTX
React JS - A quick introduction tutorial
PDF
React new features and intro to Hooks
React js programming concept
Introduction to react_js
Introduction to ReactJS
reactJS
ReactJS presentation
Reactjs
Intro to React
Node.js Express
Its time to React.js
Introduction to React JS for beginners
React js
React workshop
Introduction to ReactJS
Express js
ReactJS presentation.pptx
How native is React Native? | React Native vs Native App Development
React JS - A quick introduction tutorial
React new features and intro to Hooks
Ad

Viewers also liked (20)

PDF
Big Data & Hadoop
PPTX
Angular 2 - Better or worse
PDF
Introduction to Angular 2
ODP
Introduction to Angular 2
PPTX
PPTX
PPTX
PPTX
.NET Core
PDF
Angular 2 MVD workshop
PPTX
Angular2 workshop
PDF
Angular2 - In Action
PDF
Angular2 with type script
PDF
An Intro to Angular 2
PDF
How Angular2 Can Improve Your AngularJS Apps Today!
PDF
Angular2 - getting-ready
PDF
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...
PDF
Angular 2 overview
PDF
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Big Data & Hadoop
Angular 2 - Better or worse
Introduction to Angular 2
Introduction to Angular 2
.NET Core
Angular 2 MVD workshop
Angular2 workshop
Angular2 - In Action
Angular2 with type script
An Intro to Angular 2
How Angular2 Can Improve Your AngularJS Apps Today!
Angular2 - getting-ready
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...
Angular 2 overview
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Ad

Similar to React JS (20)

PPTX
React + Flux = Joy
PDF
An Intense Overview of the React Ecosystem
PDF
React Tech Salon
PPTX
React.js at Cortex
PPTX
ReactJS - Re-rendering pages in the age of the mutable DOM
PPTX
ReactJS Code Impact
PPTX
React.js - The Dawn of Virtual DOM
PDF
React & Flux Workshop
PPSX
React introduction
PPTX
React js
PPTX
Introduction to React JS.pptx
PDF
An Overview of the React Ecosystem
PPTX
reacts js with basic details Detailed_ReactJS_Presentation.pptx
PPTX
Introduction to ReactJS UI Web Dev .pptx
PPTX
React. Flux. Redux. by Andrey Kolodnitskiy
PPT
React js
PDF
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
PDF
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
PDF
The Road To Redux
PDF
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
React + Flux = Joy
An Intense Overview of the React Ecosystem
React Tech Salon
React.js at Cortex
ReactJS - Re-rendering pages in the age of the mutable DOM
ReactJS Code Impact
React.js - The Dawn of Virtual DOM
React & Flux Workshop
React introduction
React js
Introduction to React JS.pptx
An Overview of the React Ecosystem
reacts js with basic details Detailed_ReactJS_Presentation.pptx
Introduction to ReactJS UI Web Dev .pptx
React. Flux. Redux. by Andrey Kolodnitskiy
React js
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
The Road To Redux
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri

More from Software Infrastructure (20)

PPTX
Stream Analytics
PPTX
Quartz Scheduler
PPTX
Test Driven Development
PPTX
Deep Learning
PDF
Progressive Web Apps
PPTX
Machine learning
PPTX
PPTX
PPTX
Hazelcast sunum
PPTX
Microsoft bot framework
PPTX
Blockchain use cases
PPTX
PPTX
Server Side Swift
PPTX
Push Notification
PPTX
PPTX
Stream Analytics
Quartz Scheduler
Test Driven Development
Deep Learning
Progressive Web Apps
Machine learning
Hazelcast sunum
Microsoft bot framework
Blockchain use cases
Server Side Swift
Push Notification

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Approach and Philosophy of On baking technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Cloud computing and distributed systems.
PDF
Modernizing your data center with Dell and AMD
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Per capita expenditure prediction using model stacking based on satellite ima...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Approach and Philosophy of On baking technology
“AI and Expert System Decision Support & Business Intelligence Systems”
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Encapsulation_ Review paper, used for researhc scholars
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Building Integrated photovoltaic BIPV_UPV.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Big Data Technologies - Introduction.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Cloud computing and distributed systems.
Modernizing your data center with Dell and AMD
Agricultural_Statistics_at_a_Glance_2022_0.pdf
The AUB Centre for AI in Media Proposal.docx
Chapter 3 Spatial Domain Image Processing.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
NewMind AI Weekly Chronicles - August'25 Week I
Advanced methodologies resolving dimensionality complications for autism neur...

React JS

  • 1. 18.08.2016 Fatih Şimşek - Software Infrastructure React
  • 2. React Open source Javascript Library Created by Jordan Walke, a software engineer at Facebook First deployed on Facebook’s newsfeed in 2011 Maintained by Facebook, Instagram and a community of individual developers and corporations
  • 3. Who is using React? 9flats - Airbnb - Alipay - Atlassian - BBC - Box - Capital One - Coursera -Dailymotion - Deezer - Docker - Expedia - Facebook - Fotocasa - HappyFresh - IMDb - Instacart - Instagram - Khan Academy - Klarna - Lyft - NBC - Netflix - NFL - Paypal - Periscope - Ralph Lauren - Reddit – Salesforce - Sberbank - Stack Overflow - Tesla - Tmall - The New York Times - Twitter Fabric - Twitter Mobile - Uber - WhatsApp - Wired - Yahoo - Zendesk https://github.com/facebook/react/wiki/Sites-Using-React
  • 5. React Creating user interface(V in MVC model) Speed Declarative Composable Learn Once, Write Anywhere Support ES6 Testable
  • 6. Write once, Run Everywhere React
  • 8. Architecture Component manage own state One way binding JSX Virtual DOM Component Lifecycle
  • 9. JSX Supports xml-like syntax inline in JavaScript Each element is transformed into a Javascript function call • <Hello /> => Hello(null) • <div /> => React.DOM.div(null)
  • 10. Virtual DOM Problem: • DOM manipulation is expensive • Touching DOM is hard to test • Re-render all parts of DOM make your app slowly
  • 11. Virtual DOM Solution: When the component’s state is changed, React • Use different algorithm with the browser DOM tree to identify the changes • Instead of creating new object, React just identify what change is took place and once identify update that state • Render the subtree of DOM elements into the rendering of the DOM
  • 13. DEMO
  • 14. Prop / State Prop: • Used to pass parameter from parent to children • PropTypes used to validate properties • getDefaultProps State: • Used to manage state inside component • getInitialState • setState
  • 16. Mixins / Statics Mixins: • Different components may share some common functionality • Several mixins can be defined • Methods defined on mixins run in the order mixins were listed Statics: • Like .Net / Java static method • Define static methods in statics block of component
  • 17. Events componentWillMount: Invoked once before the initial render componentDidMount: Invoked once, only on the client componentWillReceiveProps: Invoked when a component is receiving new props shouldComponentUpdate: Invoked before rendering when new props or state are being received componentWillUpdate: Invoked immediately before rendering when new props or state are being received componentDidUpdate: Invoked immediately after the component's updates are flushed to the DOM componentWillUnmount: Invoked immediately before a component is unmounted from the DOM
  • 19. DEMO
  • 21. Flux Action: Helper method that facilitate passing data to the Dispatcher Dispatcher: Receive action and broadcast payload to registered callback Store: Containers for application state & logic that have callbacks registered to the dispatcher View: State from Stores and pass it down via props to child components
  • 22. Flux
  • 23. Redux • Single source of truth • State is read-only • Mutations are written as pure functions (reducers)
  • 24. Redux • Important difference to Flux: no dispatching inside the action • There is no Dispatcher at all; pure functions do not need to be managed, they need to be composed • Mutations are written as pure functions

Editor's Notes

  • #3: In 2010, Facebook released an extension for PHP called XHP. XHP help to decrease XSS attack and make front-end much both readable and understand. There was a distinct problem with XHP: dynamic webapplications require many roundtrips to the server. XHP did not solve this problem. Jordan Walke negotiated with his manager to take XHP into the browser using JavaScript and was granted six months to try it It was first deployed on Facebook's newsfeed in 2011 and later on Instagram.com in 2012. It was open-sourced at JSConf US in May 2013. React Native, which enables native iOS and Android development with React, was announced at Facebook's React.js Conf in February 2015 and open-sourced in March 2015.
  • #4: http://reactkungfu.com/2015/07/big-names-using-react-js/ Netflix – React Conf 2015 https://www.youtube.com/watch?v=eNC0mRYGWgc Sberbank - the number one bank in Russia I must say, I was really shocked when I heard that the interactive part of bank’s website was developed in React. One of the developers working on that project shared his team’s experience on React’s Google Group. They were really happy about the speed of development with React. https://groups.google.com/forum/#!topic/reactjs/Kj6WATX0atg At Instagram we migrated from the standard Mustache/Backbone/jQuery trio to React with a little bit of Backbone. One big benefit of this move was that we could express our display logic with pure JS, so we can use all the standard object-oriented and procedural techniques to reuse code
  • #6: Speed! Render < 16ms Declarative Easier to reason about Easier to prevent bugs Composable ( build larger tree with Learn Once, Write Anywhere ( Mobile, Web )
  • #7: Facebook has been working to help build a cross-platform development platform called React. Earlier this year, Facebook announced React Native, a learn-once, run-everywhere platform to take JavaScript and build native-like apps for iOS and Android. Run on server-side on NodeJs. Discontinuing IE8 support in React DOM, January 2016.
  • #9: Data flow from the parent to the children component by the state and the props Only one parent is responsible to update the states and passing the value to the children components via props setState is used to update/refresh the UI when the state change and the value can be pass to the children component by the this.props Event flow up, data flow down
  • #10: Transform JSX to pure JavaScript immediately before execution Convenient for the developer Significant performance penalty Can’t be minified Use Babel.js / JSXTransformer.js deprecated https://babeljs.io/repl/
  • #13: http://www.slideshare.net/emadb/an-introduction-to-reactjs-46258876
  • #14: Simple Render (Hello World)
  • #15: https://facebook.github.io/react/docs/reusable-components.html
  • #18: componentWillMount: Good place to make connection to your db service componentDidMount: It is good place for you to make AJAX request to fetch data for first used. componentWillReceiveProps: Use this method as a way to react to a prop change before render() is called by updating the state with setState. componentWillUnmount: Perform any necessary cleanup in this method(Ex: invalidating timers, clear up DOM elements were created at componentDidMount)
  • #19: http://www.slideshare.net/xmlilley/react-flux-50660816 (23.slide)
  • #20: Sample Jquery / Knockout / AngularJs / React http://getbootstrap.com/css/#forms http://getbootstrap.com/components/#list-group http://getbootstrap.com/components/#glyphicons-examples
  • #22: Flux is an architecture that Facebook uses internally when working with React. It isnot a framework or a library. It is simply a new kind of architecture that complements React and the concept of Unidirectional Data Flow. Dispatcher is the central hub that manages all data flow, It is a registry of callbacks into the stores Action typically triggered by the View, contain information about change made to the application Store contain application state and logic, reacts to specific action. View has list of stores which provide data for, trigger action with the state changes
  • #23: After you use Flux the first time, writing React without Flux feels like DOM traversal without jQuery. You can absolutely do it, but it feels less elegant and structured. Flummox, Alt, Fluxxor are libraries implement Flux. https://scotch.io/tutorials/creating-a-simple-shopping-cart-with-react-js-and-flux http://fluxxor.com/examples/carousel/
  • #24: Actions are payloads of information that send data from your application to your store Reducer is a pure function that takes the previous state and an action, and returns the next state. Store is the object that brings them together. (holds application state) You call store.dispatch(action) The Redux store calls the reducer function you gave it The root reducer may combine the output of multiple reducers into a single state tree The Redux store saves the complete state tree returned by the root reducer
  • #26: BenchMark Site: https://cdn.rawgit.com/krausest/js-framework-benchmark/a358bc967e1d9ff0c268b43f5ab8b832abe0476e/webdriver-java/table.html https://github.com/krausest/js-framework-benchmark React & Angular2 http://www.slideshare.net/boyney123/reactjs-or-angular?qid=f24b044d-6e77-4eaa-b4f4-882c5a56f454&v=&b=&from_search=15