SlideShare a Scribd company logo
REACT JS
A JAVASCRIPT LIBRARY FOR BUILDING USER INTERFACES
➤ Declarative
➤ Component-Based
➤ Learn Once, Write Anywhere
React is all about building components. The only thing to do with react is building components . They are incapsulated,
reusable and easy testing.
Imperative: $(button).removeClass('red').addClass('blue').
Declarative: this.setState({button: ‘blue’}); // color: this.state.button
It is a component oriented abstraction
FEATURES
➤ One-way data flow
➤ Virtual DOM
➤ JSX
➤ Architecture beyond HTML
➤ Simple semantics (props, state, lifecycle)
➤ React Native
virtual-dom is a collection of modules designed to provide a declarative way of representing the DOM for your app.
So instead of updating the DOM when your application state changes, you simply create a virtual tree or VTree,
which looks like the DOM state that you want.
JSX is a statically-typed, object-oriented programming language designed to run on modern web browsers.
Javascript XML based extension that compile just the template part of your code.
faster (12% faster on iOS 5.1, 29% faster on Android 2.3) / safer / easier ( offer solid class system )
The basic architecture of React applies beyond rendering HTML in the browser.
React architecture in IOS/Android native apps.
No classical MVC just COMPONENTS and one way data flow!!!
VS
VIRTUAL DOM Dom mirroring
RENDER CALLS ON EVERY STATE UPDATE
render: function () {
return <p> Hello {this.props.text}</p>;
}
➤ <p> - pure javascript, in-memory representation of DOM node
➤ render fires whenever something changes
PROPS AND STATE
PROPS - data that can be IMMUTABLE
const childComponent = React.createClass({

…

doStuff: function() {

this.props.foo = ‘smth else’; < error

}

})
STATE - data that can be MUTABLE
const childComponent = React.createClass({

…

doStuff: function() {

this.setState({foo: ’smth else’}); < ok

}

})
Components can get immutable data via props from parent components (flow)
or managed their own state via state…
React JS and Redux
React JS and Redux
INLINE STYLES
var divStyle = {
padding: 10,
margin: 10,
backgroundColor: this.props.bgcolor,
color: "#333",
display: "inline-block",
fontFamily: "monospace",
fontSize: "32",
textAlign: "center"
};
ReactDOM.render(<div style={divStyle}>Hello World!</div>, mountNode);
REACT COMPONENT AND PROPS
REACT COMPONENT AND STATE
MANAGING STATE AND COMPONENT LIFECYCLE
REACT ROUTING
React Router is a powerful routing library built on top of React that helps you add new screens
and flows to your application incredibly quickly, all while keeping the URL in sync with what's
being displayed on the page.
// First we import some modules...
import { Router, Route, IndexRoute, Link, hashHistory } from 'react-router'
render((
<Router history={hashHistory}>
<Route path="/" component={App}>
<IndexRoute component={Home} />
<Route path="about" component={About} />
<Route path="inbox" component={Inbox} />
</Route>
</Router>
), document.body)
PROS AND CONS
➤ License
"The license granted hereunder will terminate, automatically and without notice, if you initiate directly or indirectly, or
take a direct financial interest in, any Patent Assertion: (i) against Facebook or any of its subsidiaries or corporate
affiliates, (ii) against any party if such Patent Assertion arises in whole or in part from any software, technology,
product or service of Facebook or any of its subsidiaries or corporate affiliates, or (iii) against any party relating to the
Software. [...]
CONS
PROS
➤ Components are reusable anywhere in your app.
➤ Testing / Isolated components / Virtual DOM / Isomorphic
➤ Simple UI structure.
➤ It's not a full framework.
➤ It's kind of verbose.
Writing components isn't as straight forward as pure HTML & JS , everything inside component…
➤ It's not a full framework.

More Related Content

PDF
React state managmenet with Redux
PPTX
Introduction to React JS for beginners
PPTX
React + Redux Introduction
ODP
Introduction to ReactJS
PDF
React and redux
PPTX
What is component in reactjs
PPTX
React hooks
PDF
ReactJS presentation
React state managmenet with Redux
Introduction to React JS for beginners
React + Redux Introduction
Introduction to ReactJS
React and redux
What is component in reactjs
React hooks
ReactJS presentation

What's hot (20)

PPTX
React JS - A quick introduction tutorial
PDF
An introduction to React.js
PDF
React for Beginners
PPTX
React workshop
PDF
React js use contexts and useContext hook
PDF
React for Dummies
PPTX
React Hooks
PDF
Introduction to Redux
PPTX
Introduction to React
PPTX
ReactJS presentation.pptx
PDF
React JS - Introduction
PPTX
React js programming concept
PPTX
React Class Components vs Functional Components: Which is Better?
PPTX
React state
PPTX
A Brief Introduction to React.js
DOCX
Mongoose getting started-Mongo Db with Node js
PDF
Basics of React Hooks.pptx.pdf
PPTX
Angular Data Binding
PPTX
React hooks
PPTX
Javascript 101
React JS - A quick introduction tutorial
An introduction to React.js
React for Beginners
React workshop
React js use contexts and useContext hook
React for Dummies
React Hooks
Introduction to Redux
Introduction to React
ReactJS presentation.pptx
React JS - Introduction
React js programming concept
React Class Components vs Functional Components: Which is Better?
React state
A Brief Introduction to React.js
Mongoose getting started-Mongo Db with Node js
Basics of React Hooks.pptx.pdf
Angular Data Binding
React hooks
Javascript 101
Ad

Similar to React JS and Redux (20)

PDF
ReactJS - A quick introduction to Awesomeness
PPTX
PDF
react hook and wesite making structure ppt
PPTX
BackboneJS + ReactJS
PDF
Introduction Web Development using ReactJS
PDF
Full Stack React Workshop [CSSC x GDSC]
PPTX
React 101 by Anatoliy Sieryi
PPTX
User Interface
PPTX
React october2017
PDF
Connect.js - Exploring React.Native
PPTX
React + Redux + TypeScript === ♥
PDF
React on Rails - RailsConf 2017 (Phoenix)
PPTX
Introduction to React and MobX
PPTX
Let's react - Meetup
PPTX
React & Redux for noobs
PDF
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ODP
ZK MVVM, Spring & JPA On Two PaaS Clouds
PDF
Exploring the continuum between Cordova and React Native
PDF
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
PDF
React Native for multi-platform mobile applications
ReactJS - A quick introduction to Awesomeness
react hook and wesite making structure ppt
BackboneJS + ReactJS
Introduction Web Development using ReactJS
Full Stack React Workshop [CSSC x GDSC]
React 101 by Anatoliy Sieryi
User Interface
React october2017
Connect.js - Exploring React.Native
React + Redux + TypeScript === ♥
React on Rails - RailsConf 2017 (Phoenix)
Introduction to React and MobX
Let's react - Meetup
React & Redux for noobs
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ZK MVVM, Spring & JPA On Two PaaS Clouds
Exploring the continuum between Cordova and React Native
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
React Native for multi-platform mobile applications
Ad

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PDF
Machine learning based COVID-19 study performance prediction
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Spectroscopy.pptx food analysis technology
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
KodekX | Application Modernization Development
PDF
Approach and Philosophy of On baking technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Big Data Technologies - Introduction.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
Teaching material agriculture food technology
Machine learning based COVID-19 study performance prediction
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Spectroscopy.pptx food analysis technology
Building Integrated photovoltaic BIPV_UPV.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
KodekX | Application Modernization Development
Approach and Philosophy of On baking technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Network Security Unit 5.pdf for BCA BBA.
Per capita expenditure prediction using model stacking based on satellite ima...
sap open course for s4hana steps from ECC to s4
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
MIND Revenue Release Quarter 2 2025 Press Release
Big Data Technologies - Introduction.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Programs and apps: productivity, graphics, security and other tools

React JS and Redux

  • 1. REACT JS A JAVASCRIPT LIBRARY FOR BUILDING USER INTERFACES ➤ Declarative ➤ Component-Based ➤ Learn Once, Write Anywhere React is all about building components. The only thing to do with react is building components . They are incapsulated, reusable and easy testing. Imperative: $(button).removeClass('red').addClass('blue'). Declarative: this.setState({button: ‘blue’}); // color: this.state.button It is a component oriented abstraction
  • 2. FEATURES ➤ One-way data flow ➤ Virtual DOM ➤ JSX ➤ Architecture beyond HTML ➤ Simple semantics (props, state, lifecycle) ➤ React Native virtual-dom is a collection of modules designed to provide a declarative way of representing the DOM for your app. So instead of updating the DOM when your application state changes, you simply create a virtual tree or VTree, which looks like the DOM state that you want. JSX is a statically-typed, object-oriented programming language designed to run on modern web browsers. Javascript XML based extension that compile just the template part of your code. faster (12% faster on iOS 5.1, 29% faster on Android 2.3) / safer / easier ( offer solid class system ) The basic architecture of React applies beyond rendering HTML in the browser. React architecture in IOS/Android native apps.
  • 3. No classical MVC just COMPONENTS and one way data flow!!! VS
  • 4. VIRTUAL DOM Dom mirroring
  • 5. RENDER CALLS ON EVERY STATE UPDATE render: function () { return <p> Hello {this.props.text}</p>; } ➤ <p> - pure javascript, in-memory representation of DOM node ➤ render fires whenever something changes
  • 6. PROPS AND STATE PROPS - data that can be IMMUTABLE const childComponent = React.createClass({
 …
 doStuff: function() {
 this.props.foo = ‘smth else’; < error
 }
 }) STATE - data that can be MUTABLE const childComponent = React.createClass({
 …
 doStuff: function() {
 this.setState({foo: ’smth else’}); < ok
 }
 }) Components can get immutable data via props from parent components (flow) or managed their own state via state…
  • 9. INLINE STYLES var divStyle = { padding: 10, margin: 10, backgroundColor: this.props.bgcolor, color: "#333", display: "inline-block", fontFamily: "monospace", fontSize: "32", textAlign: "center" }; ReactDOM.render(<div style={divStyle}>Hello World!</div>, mountNode);
  • 12. MANAGING STATE AND COMPONENT LIFECYCLE
  • 13. REACT ROUTING React Router is a powerful routing library built on top of React that helps you add new screens and flows to your application incredibly quickly, all while keeping the URL in sync with what's being displayed on the page. // First we import some modules... import { Router, Route, IndexRoute, Link, hashHistory } from 'react-router' render(( <Router history={hashHistory}> <Route path="/" component={App}> <IndexRoute component={Home} /> <Route path="about" component={About} /> <Route path="inbox" component={Inbox} /> </Route> </Router> ), document.body)
  • 14. PROS AND CONS ➤ License "The license granted hereunder will terminate, automatically and without notice, if you initiate directly or indirectly, or take a direct financial interest in, any Patent Assertion: (i) against Facebook or any of its subsidiaries or corporate affiliates, (ii) against any party if such Patent Assertion arises in whole or in part from any software, technology, product or service of Facebook or any of its subsidiaries or corporate affiliates, or (iii) against any party relating to the Software. [...] CONS PROS ➤ Components are reusable anywhere in your app. ➤ Testing / Isolated components / Virtual DOM / Isomorphic ➤ Simple UI structure. ➤ It's not a full framework. ➤ It's kind of verbose. Writing components isn't as straight forward as pure HTML & JS , everything inside component… ➤ It's not a full framework.