SlideShare a Scribd company logo
1 of 110
REACT.JS
RETHINKING UI DEVELOPMENT WITH JAVASCRIPT
Introduction
Agenda
Overview
Components
JSX
Data for component
The component lifecycle
Component Methods
Component Breakdown
React v0.14
Flux (Intro)
React: Overview
A powerful framework by FB
❖ Implements a virtual DOM
❖ Allows us to render components super fast
❖ Removes any unnecessary overhead from DOM operations
❖ Deal with the "V" of any MVC framework
❖ Implements a virtual DOM
❖ Allows us to render components super fast
❖ Removes any unnecessary overhead from DOM operations
❖ Deal with the "V" of any MVC framework
❖ Implements a virtual DOM
❖ Allows us to render components super fast
❖ Removes any unnecessary overhead from DOM operations
❖ Deal with the "V" of any MVC framework
“The way we are able to figure this out is that React does
not manipulate the DOM unless it needs to.
It uses a fast, internal mock DOM to perform diffs and
computes the most efficient DOM mutation for you.”
- React Doc
❖ Implements a virtual DOM
❖ Allows us to render components super fast
❖ Removes any unnecessary overhead from DOM operations
❖ Deal with the "V" of any MVC framework
var msg = 'Bad';
$userMsg.html( '<p>I love Breaking ' + msg );
var data = {
'user_id' : 13,
'user_name' : 'W.W',
'user_msg' : 'I am the one who knocks!'
};
$chatList.append(
[
'<li class="chat__msg-wrap">',
'<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>',
'<span class="chat__user-name">' + data.user_name + '</span>',
'<span class="chat__user-msg">' + data.user_msg + '</span>',
'</li>'
].join();
);
❖ Implements a virtual DOM
❖ Allows us to render components super fast
❖ Removes any unnecessary overhead from DOM operations
❖ Deal with the "V" of any MVC framework
var msg = 'Bad';
$userMsg.html( '<p>I love Breaking ' + msg );
var data = {
'user_id' : 13,
'user_name' : 'W.W',
'user_msg' : 'I am the one who knocks!'
};
$chatList.append(
[
'<li class="chat__msg-wrap">',
'<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>',
'<span class="chat__user-name">' + data.user_name + '</span>',
'<span class="chat__user-msg">' + data.user_msg + '</span>',
'</li>'
].join();
);
❖ Implements a virtual DOM
❖ Allows us to render components super fast
❖ Removes any unnecessary overhead from DOM operations
❖ Deal with the "V" of any MVC framework
❖ Implements a virtual DOM
❖ Allows us to render components super fast
❖ Removes any unnecessary overhead from DOM operations
❖ Deal with the "V" of any MVC framework
❖ Implements a virtual DOM
❖ Allows us to render components super fast
❖ Removes any unnecessary overhead from DOM operations
❖ Deal with the "V" of any MVC framework
Components
Special functionality unit
❖ Each component is contained in its own "scope"
❖ Define the functionality and reuse it as many times
❖ Has a render function, which returns the HTML the component will render in the
browser
❖ We can call other React component's too
❖ Each component is contained in its own "scope"
❖ Define the functionality and reuse it as many times
❖ Has a render function, which returns the HTML the component will render in the
browser
❖ We can call other React component's too
❖ Each component is contained in its own "scope"
❖ Define the functionality and reuse it as many times
❖ Has a render function, which returns the HTML the component will render in the
browser
❖ We can call other React component's too
❖ Each component is contained in its own "scope"
❖ Define the functionality and reuse it as many times
❖ Has a render function, which returns the HTML the component will render in the
browser
❖ We can call other React component's too
❖ Each component is contained in its own "scope"
❖ Define the functionality and reuse it as many times
❖ Has a render function, which returns the HTML the component will render in the
browser
❖ We can call other React component's too
JSX
HTML inside of JS
❖ Write HTML inside of Javascript without having to wrap strings around it
❖ We don't have to worry about strings and multiple lines etc
❖ Transform the JSX in the browser on runtime - not recommended as it slows down your page
❖ Both gulp and grunt offer a JSX transformer
❖ Write HTML inside of Javascript without having to wrap strings around it
❖ We don't have to worry about strings and multiple lines etc
❖ Transform the JSX in the browser on runtime - not recommended as it slows down your page
❖ Both gulp and grunt offer a JSX transformer
❖ Write HTML inside of Javascript without having to wrap strings around it
❖ We don't have to worry about strings and multiple lines etc
❖ Transform the JSX in the browser on runtime - not recommended as it slows down your page
❖ Both gulp and grunt offer a JSX transformer
$chatList.append( '<li class="chat__msg-wrap"> <img class="chat__user-img" src="' +
getUserImg(data.user_id) + '"/> <span class="chat__user-name">' + data.user_name +
'</span> <span class="chat__user-msg">' + data.user_msg + '</span> </li>' );
$chatList.append(
'<li class="chat__msg-wrap">' +
'<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>' +
'<span class="chat__user-name">' + data.user_name + '</span>' +
'<span class="chat__user-msg">' + data.user_msg + '</span>' +
'</li>'
);
$chatList.append(
[
'<li class="chat__msg-wrap">',
'<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>',
'<span class="chat__user-name">' + data.user_name + '</span>',
'<span class="chat__user-msg">' + data.user_msg + '</span>',
'</li>'
].join();
);
$chatList.append( '<li class="chat__msg-wrap"> <img class="chat__user-img" src="' +
getUserImg(data.user_id) + '"/> <span class="chat__user-name">' + data.user_name +
'</span> <span class="chat__user-msg">' + data.user_msg + '</span> </li>' );
$chatList.append(
'<li class="chat__msg-wrap">' +
'<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>' +
'<span class="chat__user-name">' + data.user_name + '</span>' +
'<span class="chat__user-msg">' + data.user_msg + '</span>' +
'</li>'
);
$chatList.append(
[
'<li class="chat__msg-wrap">',
'<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>',
'<span class="chat__user-name">' + data.user_name + '</span>',
'<span class="chat__user-msg">' + data.user_msg + '</span>',
'</li>'
].join();
);
$chatList.append( '<li class="chat__msg-wrap"> <img class="chat__user-img" src="' +
getUserImg(data.user_id) + '"/> <span class="chat__user-name">' + data.user_name +
'</span> <span class="chat__user-msg">' + data.user_msg + '</span> </li>' );
$chatList.append(
'<li class="chat__msg-wrap">' +
'<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>' +
'<span class="chat__user-name">' + data.user_name + '</span>' +
'<span class="chat__user-msg">' + data.user_msg + '</span>' +
'</li>'
);
$chatList.append(
[
'<li class="chat__msg-wrap">',
'<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>',
'<span class="chat__user-name">' + data.user_name + '</span>',
'<span class="chat__user-msg">' + data.user_msg + '</span>',
'</li>'
].join();
);
❖ Write HTML inside of Javascript without having to wrap strings around it
❖ We don't have to worry about strings and multiple lines etc
❖ Transform the JSX in the browser on runtime - not recommended as it slows down your page
❖ Both gulp and grunt offer a JSX transformer
❖ Write HTML inside of Javascript without having to wrap strings around it
❖ We don't have to worry about strings and multiple lines etc
❖ Transform the JSX in the browser on runtime - not recommended as it slows down your page
❖ Both gulp and grunt offer a JSX transformer
Using JSX
var ExampleComponent = React.createClass({
render: function () {
return (
<div className="navigation">
Hello World!
</div>
);
}
});
var ExampleComponent = React.createClass({
render: function () {
return (
React.createElement('div', {className: 'navigation'},
'Hello World!')
);
}
});
❖ You don't have to use JSX
❖ Using className since class is a reserved word in Javascript
❖ JSX transforms the code, changes all the attributes on the node into an object
Using variables for attributes
var ExampleComponent = React.createClass({
render: function () {
var navigationClass = 'navigation';
return (
<div className={ navigationClass }>
Hello World!
</div>
);
}
});
❖ Dynamically change the class of a component
❖ Wrap it around a set of curly braces, so JSX knows that it is an external variable
The Initial Render
var ExampleComponent = React.createClass({
render: function () {
var navigationClass = 'navigation';
return (
<div className={ navigationClass }>
Hello World!
</div>
);
}
});
ReactDOM.render( <ExampleComponent />, document.body );
❖ Tell React which component to render, and point to an existing DOM node for where to render it
Data for component
Props and States
Props
❖ Props is the data passed into a component
❖ Props is accessed via “this.props”
❖ Props is immutable, don’t change only use
❖ Props is the data passed into a component
❖ Props is accessed via “this.props”
❖ Props is immutable, don’t change only use
❖ Props is the data passed into a component
❖ Props is accessed via “this.props”
❖ Props is immutable, don’t change only use
❖ Props is the data passed into a component
❖ Props is accessed via “this.props”
❖ Props is immutable, don’t change only use
var SayMyName = React.createClass({
render: function () {
return (
<div className="say-hello">
Hello { this.props.name }
</div>
);
}
});
var myName = 'Heisenberg';
ReactDOM.render(<SayMyName name={ myName } />, document.body);
var SayMyName = React.createClass({
render: function () {
return (
<div className="say-hello">
Hello { this.props.name }
</div>
);
}
});
var myName = 'Heisenberg';
ReactDOM.render(<SayMyName name={ myName } />, document.body);
var SayMyName = React.createClass({
render: function () {
return (
<div className="say-hello">
Hello { this.props.name }
</div>
);
}
});
var myName = 'Heisenberg';
ReactDOM.render(<SayMyName name={ myName } />, document.body);
State
❖ State is the private data within each instance of components
❖ State is accessed via “this.state”
❖ State is mutable, do whatever we want
❖ Usually we hook those data into state that represent UI
❖ Changing state will re-render UI
❖ State is the private data within each instance of components
❖ State is accessed via “this.state”
❖ State is mutable, do whatever we want
❖ Usually we hook those data into state that represent UI
❖ Changing state will re-render UI
❖ State is the private data within each instance of components
❖ State is accessed via “this.state”
❖ State is mutable, do whatever we want
❖ Usually we hook those data into state that represent UI
❖ Changing state will re-render UI
❖ State is the private data within each instance of components
❖ State is accessed via “this.state”
❖ State is mutable, do whatever we want
❖ Usually we hook those data into state that represent UI
❖ Changing state will re-render UI
❖ State is the private data within each instance of components
❖ State is accessed via “this.state”
❖ State is mutable, do whatever we want
❖ Usually we hook those data into state that represent UI
❖ Changing state will re-render UI
❖ State is the private data within each instance of components
❖ State is accessed via “this.state”
❖ State is mutable, do whatever we want
❖ Usually we hook those data into state that represent UI
❖ Changing state will re-render UI
var SayMyName = React.createClass({
getInitalState: function () {
return { greet: 'Hello' }
},
render: function () {
return (
<div className="say-hello">
{ this.state.greet } { this.props.name }
</div>
);
}
});
var myName = 'Heisenberg';
ReactDOM.render(<SayMyName name={ myName } />, document.body);
var SayMyName = React.createClass({
getInitalState: function () {
return { greet: 'Hello' }
},
render: function () {
return (
<div className="say-hello">
{ this.state.greet } { this.props.name }
</div>
);
}
});
var myName = 'Heisenberg';
ReactDOM.render(<SayMyName name={ myName } />, document.body);
var SayMyName = React.createClass({
getInitalState: function () {
return { greet: 'Hello' }
},
render: function () {
return (
<div className="say-hello">
{ this.state.greet } { this.props.name }
</div>
);
}
});
var myName = 'Heisenberg';
ReactDOM.render(<SayMyName name={ myName } />, document.body);
The component lifecycle
getInitialState
only called once, and is called as the component is
being mounted.
componentWillMount
As soon as your component is about to be mounted,
this is called.
var ExampleComponent = React.createClass({
componentWillMount: function () {
// hide any loading screens
// remove any placeholders
},
render: function () {
// this gets called many times in a components life
return (
<div>
Hello World!
</div>
);
}
});
componentDidMount
Once your component has ran the render function
and actually rendered your component in the DOM
var ExampleComponent = React.createClass({
componentDidMount: function () {
// render a chart on the DOM node
// bind events to window, like resize
},
render: function () {
return (
<div>
Hello World!
</div>
);
}
});
componentWillUnmount
If you were to remove the component from the
DOM, this function is called
var ExampleComponent = React.createClass({
componentWillUnmount: function () {
// unbind events to window, like resize
},
render: function () {
return (
<div>
Hello World!
</div>
);
}
});
Component Methods
getDefaultProps
Define the default values for the properties of the
component that we are expecting
var Navigation = React.createClass({
getDefaultProps: function () {
return {
nav: {}
}
},
render: function () {
return (
<ul className="navigation">...</ul>
);
}
});
ReactDOM.render( <Navigation nav={ navObj } />, $header );
ReactDOM.render( <Navigation />, $footer );
propTypes
Specify the type of each property we are expecting
for validation. Checked only in development mode.
var Navigation = React.createClass({
propTypes: {
nav : React.PropTypes.object,
data : React.PropTypes.array
},
render: function () {
return (
<ul className="navigation">...</ul>
);
}
});
ReactDOM.render( <Navigation nav={ navObj } />, $header );
mixins
So we don't have to write the same code twice
var ExampleMixin = {
componentDidMount: function () {
// bind resize event on window
},
componentWillUnmount: function () {
// unbind resize event from window
}
};
var ExampleComponent = React.createClass({
mixins: [ExampleMixin]
});
var AnotherComponent = React.createClass({
mixins: [ExampleMixin]
});
Loop de loop
Looping through data in array of objects
var Navigation = React.createClass({
render: function () {
var items = this.props.nav.map(function (item) {
return (
<li className="navigation__item">
<a className="navigation__link" href={ item.href }>
{ item.text }
</a>
</li>
);
});
return (
<ul className="navigation"> { items } </ul>
);
}
});
var navObj = [{
href: 'http://vijaydev.com',
text: 'My Website'
}];
ReactDOM.render( <Navigation nav={ navObj } />, $header );
var Navigation = React.createClass({
render: function () {
var items = this.props.nav.map(function (item) {
return (
<li className="navigation__item">
<a className="navigation__link" href={ item.href }>
{ item.text }
</a>
</li>
);
});
return (
<ul className="navigation"> { items } </ul>
);
}
});
var navObj = [{
href: 'http://vijaydev.com',
text: 'My Website'
}];
ReactDOM.render( <Navigation nav={ navObj } />, $header );
var Navigation = React.createClass({
render: function () {
var items = this.props.nav.map(function (item) {
return (
<li className="navigation__item">
<a className="navigation__link" href={ item.href }>
{ item.text }
</a>
</li>
);
});
return (
<ul className="navigation"> { items } </ul>
);
}
});
var navObj = [{
href: 'http://vijaydev.com',
text: 'My Website'
}];
ReactDOM.render( <Navigation nav={ navObj } />, $header );
var NavItem = React.createClass({
render: function () {
return (
<li className="navigation__item">
<a className="navigation__link" href={ this.props.href }>
{ this.props.text }
</a>
</li>
);
}
});
var Navigation = React.createClass({
render: function () {
var items = this.props.nav.map(function (item) {
return (
<NavItem href={ item.href } text={ item.text } />
);
});
return (
<ul className="navigation">{ items }</ul>
);
}
});
var NavItem = React.createClass({
render: function () {
return (
<li className="navigation__item">
<a className="navigation__link" href={ this.props.href }>
{ this.props.text }
</a>
</li>
);
}
});
var Navigation = React.createClass({
render: function () {
var items = this.props.nav.map(function (item) {
return (
<NavItem href={ item.href } text={ item.text } />
);
});
return (
<ul className="navigation">{ items }</ul>
);
}
});
var NavItem = React.createClass({
render: function () {
return (
<li className="navigation__item">
<a className="navigation__link" href={ this.props.href }>
{ this.props.text }
</a>
</li>
);
}
});
var Navigation = React.createClass({
render: function () {
var items = this.props.nav.map(function (item) {
return (
<NavItem href={ item.href } text={ item.text } />
);
});
return (
<ul className="navigation">{ items }</ul>
);
}
});
Component Breakdown
UI to reusable components
Case study: How to breakdown UI into various
reusable components
data = [{
'src' : '/path/to/image',
'alt' : 'alt text of image',
'title' : 'name of the movie',
'href' : '/path/to/the/movie/details/page',
'cast' : ['array', 'of', 'movie', 'casts'],
'rating' : 'movie rating',
'theater_href' : '/path/to/theater/list'
}, {
...
...
}, {
...
...
}];
props = [{
'src' : '/path/to/image',
'alt' : 'alt text of image',
'title' : 'name of the movie',
'href' : '/path/to/the/movie/details/page',
'cast' : ['array', 'of', 'movie', 'casts'],
'rating' : 'movie rating',
'theater_href' : '/path/to/theater/list'
}, {...}, {...}];
state = {
'actualData' : this.props,
'currWidth' : 'calculated current screen width',
'colCount' : 'based on currWidth & max column count',
'perPage' : 'based on currWidth & colCount',
'totalPages' : 'based on perPage & actualData length',
'currPageNo' : 'used in calculating pageData',
'pageData' : 'based on totalPages & currPageNo'
};
<MoviePosterContent>
<MoviePosterList data={ this.state.pageData }>
<PosterItem data={ pageData[i] }>
<PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } />
<PosterRatingTheater data={ iRating, itheaterHref } />
</PosterItem>
</MoviePosterList>
<Navigation data={ this.state.totalPages, this.state.currPageNo } />
</MoviePosterContent>
ReactDOM.render(<MoviePosterContent data={ data } />, $domNode);
<MoviePosterContent>
<MoviePosterList data={ this.state.pageData }>
<PosterItem data={ pageData[i] }>
<PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } />
<PosterRatingTheater data={ iRating, itheaterHref } />
</PosterItem>
</MoviePosterList>
<Navigation data={ this.state.totalPages, this.state.currPageNo } />
</MoviePosterContent>
ReactDOM.render( <MoviePosterContent data={ data } />, $domNode );
<MoviePosterContent>
<MoviePosterList data={ this.state.pageData }>
<PosterItem data={ pageData[i] }>
<PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } />
<PosterRatingTheater data={ iRating, itheaterHref } />
</PosterItem>
</MoviePosterList>
<Navigation data={ this.state.totalPages, this.state.currPageNo } />
</MoviePosterContent>
ReactDOM.render(<MoviePosterContent data={ data } />, $domNode);
<MoviePosterContent>
<MoviePosterList data={ this.state.pageData }>
<PosterItem data={ pageData[i] }>
<PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } />
<PosterRatingTheater data={ iRating, itheaterHref } />
</PosterItem>
</MoviePosterList>
<Navigation data={ this.state.totalPages, this.state.currPageNo } />
</MoviePosterContent>
ReactDOM.render( <MoviePosterContent data={ data } />, $domNode );
props = [{
'src' : '/path/to/image',
'alt' : 'alt text of image',
'title' : 'name of the movie',
'href' : '/path/to/the/movie/details/page',
'cast' : ['array', 'of', 'movie', 'casts'],
'rating' : 'movie rating',
'theater_href' : '/path/to/theater/list'
}, {...}, {...}];
state = {
'actualData' : this.props,
'currWidth' : 'calculated current screen width',
'colCount' : 'based on currWidth & max column count',
'perPage' : 'based on currWidth & colCount',
'totalPages' : 'based on perPage & actualData length',
'currPageNo' : 'used in calculating pageData',
'pageData' : 'based on totalPages & currPageNo'
};
<MoviePosterContent>
<MoviePosterList data={ this.state.pageData }>
<PosterItem data={ pageData[i] }>
<PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } />
<PosterRatingTheater data={ iRating, itheaterHref } />
</PosterItem>
</MoviePosterList>
<Navigation data={ this.state.totalPages, this.state.currPageNo } />
</MoviePosterContent>
ReactDOM.render(<MoviePosterContent data={ data } />, $domNode);
<MoviePosterContent>
<MoviePosterList data={ this.state.pageData }>
<PosterItem data={ pageData[i] }>
<PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } />
<PosterRatingTheater data={ iRating, itheaterHref } />
</PosterItem>
</MoviePosterList>
<Navigation data={ this.state.totalPages, this.state.currPageNo } />
</MoviePosterContent>
ReactDOM.render( <MoviePosterContent data={ data } />, $domNode );
<MoviePosterContent>
<MoviePosterList data={ this.state.pageData }>
<PosterItem data={ pageData[i] }>
<PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } />
<PosterRatingTheater data={ iRating, itheaterHref } />
</PosterItem>
</MoviePosterList>
<Navigation data={ this.state.totalPages, this.state.currPageNo } />
</MoviePosterContent>
ReactDOM.render(<MoviePosterContent data={ data } />, $domNode);
<MoviePosterContent>
<MoviePosterList data={ this.state.pageData }>
<PosterItem data={ pageData[i] }>
<PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } />
<PosterRatingTheater data={ iRating, itheaterHref } />
</PosterItem>
</MoviePosterList>
<Navigation data={ this.state.totalPages, this.state.currPageNo } />
</MoviePosterContent>
ReactDOM.render( <MoviePosterContent data={ data } />, $domNode );
props = [{
'src' : '/path/to/image',
'alt' : 'alt text of image',
'title' : 'name of the movie',
'href' : '/path/to/the/movie/details/page',
'cast' : ['array', 'of', 'movie', 'casts'],
'rating' : 'movie rating',
'theater_href' : '/path/to/theater/list'
}, {...}, {...}];
state = {
'actualData' : this.props,
'currWidth' : 'calculated current screen width',
'colCount' : 'based on currWidth & max column count',
'perPage' : 'based on currWidth & colCount',
'totalPages' : 'based on perPage & actualData length',
'currPageNo' : 'used in calculating pageData',
'pageData' : 'based on totalPages & currPageNo'
};
<MoviePosterContent>
<MoviePosterList data={ this.state.pageData }>
<PosterItem data={ pageData[i] }>
<PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } />
<PosterRatingTheater data={ iRating, itheaterHref } />
</PosterItem>
</MoviePosterList>
<Navigation data={ this.state.totalPages, this.state.currPageNo } />
</MoviePosterContent>
ReactDOM.render(<MoviePosterContent data={ data } />, $domNode);
<MoviePosterContent>
<MoviePosterList data={ this.state.pageData }>
<PosterItem data={ pageData[i] }>
<PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } />
<PosterRatingTheater data={ iRating, itheaterHref } />
</PosterItem>
</MoviePosterList>
<Navigation data={ this.state.totalPages, this.state.currPageNo } />
</MoviePosterContent>
ReactDOM.render( <MoviePosterContent data={ data } />, $domNode );
<MoviePosterContent>
<MoviePosterList data={ this.state.pageData }>
<PosterItem data={ pageData[i] }>
<PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } />
<PosterRatingTheater data={ iRating, itheaterHref } />
</PosterItem>
</MoviePosterList>
<Navigation data={ this.state.totalPages, this.state.currPageNo } />
</MoviePosterContent>
ReactDOM.render(<MoviePosterContent data={ data } />, $domNode);
<MoviePosterContent>
<MoviePosterList data={ this.state.pageData }>
<PosterItem data={ pageData[i] }>
<PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } />
<PosterRatingTheater data={ iRating, itheaterHref } />
</PosterItem>
</MoviePosterList>
<Navigation data={ this.state.totalPages, this.state.currPageNo } />
</MoviePosterContent>
ReactDOM.render( <MoviePosterContent data={ data } />, $domNode );
props = [{
'src' : '/path/to/image',
'alt' : 'alt text of image',
'title' : 'name of the movie',
'href' : '/path/to/the/movie/details/page',
'cast' : ['array', 'of', 'movie', 'casts'],
'rating' : 'movie rating',
'theater_href' : '/path/to/theater/list'
}, {...}, {...}];
state = {
'actualData' : this.props,
'currWidth' : 'calculated current screen width',
'colCount' : 'based on currWidth & max column count',
'perPage' : 'based on currWidth & colCount',
'totalPages' : 'based on perPage & actualData length',
'currPageNo' : 'used in calculating pageData',
'pageData' : 'based on totalPages & currPageNo'
};
React v0.14
❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three”
❖ Deprecated: “react-tools” package and “JSXTransform.js”
❖ React namespace split into React and ReactDOM
❖ React keep core functionalities for creating components
❖ ReactDOM for rendering in DOM
React.render(<SayMyName name={ myName } />, document.body);
ReactDOM.render(<SayMyName name={ myName } />, document.body);
❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three”
❖ Deprecated: “react-tools” package and “JSXTransform.js”
❖ React namespace split into React and ReactDOM
❖ React keep core functionalities for creating components
❖ ReactDOM for rendering in DOM
React.render(<SayMyName name={ myName } />, document.body);
ReactDOM.render(<SayMyName name={ myName } />, document.body);
❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three”
❖ Deprecated: “react-tools” package and “JSXTransform.js”
❖ React namespace split into React and ReactDOM
❖ React keep core functionalities for creating components
❖ ReactDOM for rendering in DOM
React.render(<SayMyName name={ myName } />, document.body);
ReactDOM.render(<SayMyName name={ myName } />, document.body);
“This paves the way to writing components that can
be shared between the web version of React and
React Native. We don’t expect all the code in an app to
be shared, but we want to be able to share the
components that do behave the same across platforms.”
- React v0.14 release blog
❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three”
❖ Deprecated: “react-tools” package and “JSXTransform.js”
❖ React namespace split into React and ReactDOM
❖ React keep core functionalities for creating components
❖ ReactDOM for rendering in DOM
React.render(<SayMyName name={ myName } />, document.body);
ReactDOM.render(<SayMyName name={ myName } />, document.body);
❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three”
❖ Deprecated: “react-tools” package and “JSXTransform.js”
❖ React namespace split into React and ReactDOM
❖ React keep core functionalities for creating components
❖ ReactDOM for rendering in DOM
React.render(<SayMyName name={ myName } />, document.body);
ReactDOM.render(<SayMyName name={ myName } />, document.body);
❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three”
❖ Deprecated: “react-tools” package and “JSXTransform.js”
❖ React namespace split into React and ReactDOM
❖ React keep core functionalities for creating components
❖ ReactDOM for rendering in DOM
React.render(<SayMyName name={ myName } />, document.body);
ReactDOM.render(<SayMyName name={ myName } />, document.body);
❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three”
❖ Deprecated: “react-tools” package and “JSXTransform.js”
❖ React namespace split into React and ReactDOM
❖ React keep core functionalities for creating components
❖ ReactDOM for rendering in DOM
React.render(<SayMyName name={ myName } />, document.body);
ReactDOM.render(<SayMyName name={ myName } />, document.body);
“...it has become clear that the beauty and essence of
React has nothing to do with browsers or the DOM.”
- React v0.14 release blog
❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three”
❖ Deprecated: “react-tools” package and “JSXTransform.js”
❖ React namespace split into React and ReactDOM
❖ React keep core functionalities for creating components
❖ ReactDOM for rendering in DOM
React.render(<SayMyName name={ myName } />, document.body);
ReactDOM.render(<SayMyName name={ myName } />, document.body);
Flux
pageData: [
{'Puthiya Niyamam', ...},
{'Maheshinte Prathikaaram', ...},
{'Action Hero Biju', ...},
{'Mastizaade', ...}
]
pageData: [
{'Pachakallam', ...},
{'Jalam', ...},
{'Airlift', ...},
{'Kya Kool Hai Hum', ...}
]
{ type: 'NEXT_BTN_PRESS' }
{ type: 'PREV_BTN_PRESS' }
{
type: 'JUMP_TO_PAGE',
payload: {
'pageNo': 3
}
}
{
type: 'WINDOW_RESIZED',
payload: {
'newWidth': 600
}
}
{
type: 'ADD_TODO',
payload: {
text: 'Learn ES6'
}
}
{ type: 'NEXT_BTN_PRESS' }
{ type: 'PREV_BTN_PRESS' }
{
type: 'JUMP_TO_PAGE',
payload: {
'pageNo': 3
}
}
{
type: 'WINDOW_RESIZED',
payload: {
'newWidth': 600
}
}
{
type: 'ADD_TODO',
payload: {
text: 'Learn ES6'
}
}
{ type: 'NEXT_BTN_PRESS' }
{ type: 'PREV_BTN_PRESS' }
{
type: 'JUMP_TO_PAGE',
payload: {
'pageNo': 3
}
}
{
type: 'WINDOW_RESIZED',
payload: {
'newWidth': 600
}
}
{
type: 'ADD_TODO',
payload: {
text: 'Learn ES6'
}
}
Thank you
Vijay Dev
Lead Front-end Engineer
http://vijaydev.com/

More Related Content

What's hot

React in Native Apps - Meetup React - 20150409
React in Native Apps - Meetup React - 20150409React in Native Apps - Meetup React - 20150409
React in Native Apps - Meetup React - 20150409Minko3D
 
React.js or why DOM finally makes sense
React.js or why DOM finally makes senseReact.js or why DOM finally makes sense
React.js or why DOM finally makes senseEldar Djafarov
 
ReactJs presentation
ReactJs presentationReactJs presentation
ReactJs presentationnishasowdri
 
A Brief Introduction to React.js
A Brief Introduction to React.jsA Brief Introduction to React.js
A Brief Introduction to React.jsDoug Neiner
 
Better web apps with React and Redux
Better web apps with React and ReduxBetter web apps with React and Redux
Better web apps with React and ReduxAli Sa'o
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web ComponentsAndrew Rota
 
Laravel 8 export data as excel file with example
Laravel 8 export data as excel file with exampleLaravel 8 export data as excel file with example
Laravel 8 export data as excel file with exampleKaty Slemon
 
Why and How to Use Virtual DOM
Why and How to Use Virtual DOMWhy and How to Use Virtual DOM
Why and How to Use Virtual DOMDaiwei Lu
 
React.js and Redux overview
React.js and Redux overviewReact.js and Redux overview
React.js and Redux overviewAlex Bachuk
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JSArno Lordkronos
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners Varun Raj
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_jsMicroPyramid .
 

What's hot (20)

React in Native Apps - Meetup React - 20150409
React in Native Apps - Meetup React - 20150409React in Native Apps - Meetup React - 20150409
React in Native Apps - Meetup React - 20150409
 
React js
React jsReact js
React js
 
React.js or why DOM finally makes sense
React.js or why DOM finally makes senseReact.js or why DOM finally makes sense
React.js or why DOM finally makes sense
 
React JS - Introduction
React JS - IntroductionReact JS - Introduction
React JS - Introduction
 
Let's Redux!
Let's Redux!Let's Redux!
Let's Redux!
 
React
React React
React
 
ReactJs presentation
ReactJs presentationReactJs presentation
ReactJs presentation
 
A Brief Introduction to React.js
A Brief Introduction to React.jsA Brief Introduction to React.js
A Brief Introduction to React.js
 
Better web apps with React and Redux
Better web apps with React and ReduxBetter web apps with React and Redux
Better web apps with React and Redux
 
React & redux
React & reduxReact & redux
React & redux
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web Components
 
Getting Started With ReactJS
Getting Started With ReactJSGetting Started With ReactJS
Getting Started With ReactJS
 
Laravel 8 export data as excel file with example
Laravel 8 export data as excel file with exampleLaravel 8 export data as excel file with example
Laravel 8 export data as excel file with example
 
Why and How to Use Virtual DOM
Why and How to Use Virtual DOMWhy and How to Use Virtual DOM
Why and How to Use Virtual DOM
 
React / Redux Architectures
React / Redux ArchitecturesReact / Redux Architectures
React / Redux Architectures
 
React.js and Redux overview
React.js and Redux overviewReact.js and Redux overview
React.js and Redux overview
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_js
 

Viewers also liked

React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix Chen Lerner
 
2016 SUTOL: React.js – High-Performance Client for Domino
2016 SUTOL: React.js – High-Performance Client for Domino2016 SUTOL: React.js – High-Performance Client for Domino
2016 SUTOL: React.js – High-Performance Client for DominoKnut Herrmann
 
Meap and business platforms
Meap and business platformsMeap and business platforms
Meap and business platformsDeepu S Nath
 
JSX - developing a statically-typed programming language for the Web
JSX - developing a statically-typed programming language for the WebJSX - developing a statically-typed programming language for the Web
JSX - developing a statically-typed programming language for the WebKazuho Oku
 
What Makes Content Memorable?
What Makes Content Memorable?What Makes Content Memorable?
What Makes Content Memorable?Bruce Kasanoff
 
Activate Tech and Media Outlook 2016
Activate Tech and Media Outlook 2016Activate Tech and Media Outlook 2016
Activate Tech and Media Outlook 2016Activate
 
Tips, Tools and Templates To Build Your Content Marketing Strategy
Tips, Tools and Templates To Build Your Content Marketing StrategyTips, Tools and Templates To Build Your Content Marketing Strategy
Tips, Tools and Templates To Build Your Content Marketing StrategyMichael Brenner
 
How To Plan And Build A Successful Content Marketing Strategy
How To Plan And Build A Successful Content Marketing StrategyHow To Plan And Build A Successful Content Marketing Strategy
How To Plan And Build A Successful Content Marketing StrategyMichael Brenner
 
Content Marketing Strategy Workshop
Content Marketing Strategy WorkshopContent Marketing Strategy Workshop
Content Marketing Strategy WorkshopMichael Brenner
 
20 Facebook, Twitter, Linkedin & Pinterest Features You Didn't Know Existed (...
20 Facebook, Twitter, Linkedin & Pinterest Features You Didn't Know Existed (...20 Facebook, Twitter, Linkedin & Pinterest Features You Didn't Know Existed (...
20 Facebook, Twitter, Linkedin & Pinterest Features You Didn't Know Existed (...HubSpot
 
PSFK presents the Mobile Commerce Playbook
PSFK presents the Mobile Commerce PlaybookPSFK presents the Mobile Commerce Playbook
PSFK presents the Mobile Commerce PlaybookPSFK
 
The Top 10 Facebook and Twitter Advertising Hacks of All Time - Larry Kim's P...
The Top 10 Facebook and Twitter Advertising Hacks of All Time - Larry Kim's P...The Top 10 Facebook and Twitter Advertising Hacks of All Time - Larry Kim's P...
The Top 10 Facebook and Twitter Advertising Hacks of All Time - Larry Kim's P...Internet Marketing Software - WordStream
 
25 Disruptive Technology Trends 2015 - 2016
25 Disruptive Technology Trends 2015 - 201625 Disruptive Technology Trends 2015 - 2016
25 Disruptive Technology Trends 2015 - 2016Brian Solis
 
The 10 Best Copywriting Formulas for Social Media Headlines
The 10 Best Copywriting Formulas for Social Media HeadlinesThe 10 Best Copywriting Formulas for Social Media Headlines
The 10 Best Copywriting Formulas for Social Media HeadlinesBuffer
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingContent Marketing Institute
 

Viewers also liked (19)

Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix
 
2016 SUTOL: React.js – High-Performance Client for Domino
2016 SUTOL: React.js – High-Performance Client for Domino2016 SUTOL: React.js – High-Performance Client for Domino
2016 SUTOL: React.js – High-Performance Client for Domino
 
Meap and business platforms
Meap and business platformsMeap and business platforms
Meap and business platforms
 
003. ReactJS basic
003. ReactJS basic003. ReactJS basic
003. ReactJS basic
 
JSX - developing a statically-typed programming language for the Web
JSX - developing a statically-typed programming language for the WebJSX - developing a statically-typed programming language for the Web
JSX - developing a statically-typed programming language for the Web
 
What Makes Content Memorable?
What Makes Content Memorable?What Makes Content Memorable?
What Makes Content Memorable?
 
Activate Tech and Media Outlook 2016
Activate Tech and Media Outlook 2016Activate Tech and Media Outlook 2016
Activate Tech and Media Outlook 2016
 
Tips, Tools and Templates To Build Your Content Marketing Strategy
Tips, Tools and Templates To Build Your Content Marketing StrategyTips, Tools and Templates To Build Your Content Marketing Strategy
Tips, Tools and Templates To Build Your Content Marketing Strategy
 
How To Plan And Build A Successful Content Marketing Strategy
How To Plan And Build A Successful Content Marketing StrategyHow To Plan And Build A Successful Content Marketing Strategy
How To Plan And Build A Successful Content Marketing Strategy
 
How to Choose the Perfect Stock Photo
How to Choose the Perfect Stock PhotoHow to Choose the Perfect Stock Photo
How to Choose the Perfect Stock Photo
 
Work Rules!
Work Rules!Work Rules!
Work Rules!
 
Content Marketing Strategy Workshop
Content Marketing Strategy WorkshopContent Marketing Strategy Workshop
Content Marketing Strategy Workshop
 
20 Facebook, Twitter, Linkedin & Pinterest Features You Didn't Know Existed (...
20 Facebook, Twitter, Linkedin & Pinterest Features You Didn't Know Existed (...20 Facebook, Twitter, Linkedin & Pinterest Features You Didn't Know Existed (...
20 Facebook, Twitter, Linkedin & Pinterest Features You Didn't Know Existed (...
 
PSFK presents the Mobile Commerce Playbook
PSFK presents the Mobile Commerce PlaybookPSFK presents the Mobile Commerce Playbook
PSFK presents the Mobile Commerce Playbook
 
The Top 10 Facebook and Twitter Advertising Hacks of All Time - Larry Kim's P...
The Top 10 Facebook and Twitter Advertising Hacks of All Time - Larry Kim's P...The Top 10 Facebook and Twitter Advertising Hacks of All Time - Larry Kim's P...
The Top 10 Facebook and Twitter Advertising Hacks of All Time - Larry Kim's P...
 
25 Disruptive Technology Trends 2015 - 2016
25 Disruptive Technology Trends 2015 - 201625 Disruptive Technology Trends 2015 - 2016
25 Disruptive Technology Trends 2015 - 2016
 
The 10 Best Copywriting Formulas for Social Media Headlines
The 10 Best Copywriting Formulas for Social Media HeadlinesThe 10 Best Copywriting Formulas for Social Media Headlines
The 10 Best Copywriting Formulas for Social Media Headlines
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
 

Similar to REACT.JS : Rethinking UI Development Using JavaScript

Web Components v1
Web Components v1Web Components v1
Web Components v1Mike Wilcox
 
Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!Eric Palakovich Carr
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup PerformanceJustin Cataldo
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)Igor Bronovskyy
 
Integrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationIntegrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationAndrew Rota
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...Fabio Franzini
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...tdc-globalcode
 
Performance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best PracticesPerformance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best PracticesDoris Chen
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyDavid Padbury
 
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web AppsTimothy Fisher
 
Backbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVCBackbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVCpootsbook
 
Ajax Performance Tuning and Best Practices
Ajax Performance Tuning and Best PracticesAjax Performance Tuning and Best Practices
Ajax Performance Tuning and Best PracticesDoris Chen
 
e-suap - client technologies- english version
e-suap - client technologies- english versione-suap - client technologies- english version
e-suap - client technologies- english versionSabino Labarile
 
Web performance essentials - Goodies
Web performance essentials - GoodiesWeb performance essentials - Goodies
Web performance essentials - GoodiesJerry Emmanuel
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVCAlive Kuo
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpMatthew Davis
 

Similar to REACT.JS : Rethinking UI Development Using JavaScript (20)

Web Components v1
Web Components v1Web Components v1
Web Components v1
 
Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
 
Webpack
Webpack Webpack
Webpack
 
Integrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationIntegrating React.js Into a PHP Application
Integrating React.js Into a PHP Application
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
 
Performance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best PracticesPerformance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best Practices
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web Apps
 
Backbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVCBackbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVC
 
Ajax Performance Tuning and Best Practices
Ajax Performance Tuning and Best PracticesAjax Performance Tuning and Best Practices
Ajax Performance Tuning and Best Practices
 
Let's react - Meetup
Let's react - MeetupLet's react - Meetup
Let's react - Meetup
 
e-suap - client technologies- english version
e-suap - client technologies- english versione-suap - client technologies- english version
e-suap - client technologies- english version
 
Web performance essentials - Goodies
Web performance essentials - GoodiesWeb performance essentials - Goodies
Web performance essentials - Goodies
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
 
Loom and concurrency latest
Loom and concurrency latestLoom and concurrency latest
Loom and concurrency latest
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
 

More from Deepu S Nath

Design Thinking, Critical Thinking & Innovation Design
Design Thinking, Critical Thinking & Innovation DesignDesign Thinking, Critical Thinking & Innovation Design
Design Thinking, Critical Thinking & Innovation DesignDeepu S Nath
 
GTECH ATFG µLearn Framework Intro
GTECH ATFG µLearn Framework IntroGTECH ATFG µLearn Framework Intro
GTECH ATFG µLearn Framework IntroDeepu S Nath
 
Future of learning - Technology Disruption
Future of learning  - Technology DisruptionFuture of learning  - Technology Disruption
Future of learning - Technology DisruptionDeepu S Nath
 
Decentralized Applications using Ethereum
Decentralized Applications using EthereumDecentralized Applications using Ethereum
Decentralized Applications using EthereumDeepu S Nath
 
How machines can take decisions
How machines can take decisionsHow machines can take decisions
How machines can take decisionsDeepu S Nath
 
Artificial Intelligence: An Introduction
 Artificial Intelligence: An Introduction Artificial Intelligence: An Introduction
Artificial Intelligence: An IntroductionDeepu S Nath
 
FAYA PORT 80 Introduction
FAYA PORT 80 IntroductionFAYA PORT 80 Introduction
FAYA PORT 80 IntroductionDeepu S Nath
 
How machines can take decisions
How machines can take decisionsHow machines can take decisions
How machines can take decisionsDeepu S Nath
 
Simplified Introduction to AI
Simplified Introduction to AISimplified Introduction to AI
Simplified Introduction to AIDeepu S Nath
 
Mining Opportunities of Block Chain and BitCoin
Mining Opportunities of Block Chain and BitCoinMining Opportunities of Block Chain and BitCoin
Mining Opportunities of Block Chain and BitCoinDeepu S Nath
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOpsDeepu S Nath
 
Coffee@DBG - TechBites March 2016
Coffee@DBG - TechBites March 2016Coffee@DBG - TechBites March 2016
Coffee@DBG - TechBites March 2016Deepu S Nath
 
SEO For Developers
SEO For DevelopersSEO For Developers
SEO For DevelopersDeepu S Nath
 
Life Cycle of an App - From Idea to Monetization
Life Cycle of an App - From Idea to Monetization  Life Cycle of an App - From Idea to Monetization
Life Cycle of an App - From Idea to Monetization Deepu S Nath
 
Uncommon Python - What is special in Python
Uncommon Python -  What is special in PythonUncommon Python -  What is special in Python
Uncommon Python - What is special in PythonDeepu S Nath
 
Coffee@DBG - TechBites Sept 2015
Coffee@DBG - TechBites Sept 2015Coffee@DBG - TechBites Sept 2015
Coffee@DBG - TechBites Sept 2015Deepu S Nath
 
Techbites July 2015
Techbites July 2015Techbites July 2015
Techbites July 2015Deepu S Nath
 
Apple Watch - Start Your Developer Engine
Apple Watch -  Start Your Developer EngineApple Watch -  Start Your Developer Engine
Apple Watch - Start Your Developer EngineDeepu S Nath
 
Greetings & Response - English Communication Training
Greetings & Response - English Communication TrainingGreetings & Response - English Communication Training
Greetings & Response - English Communication TrainingDeepu S Nath
 
Hybrid Mobile App Development - Xamarin
Hybrid Mobile App Development - XamarinHybrid Mobile App Development - Xamarin
Hybrid Mobile App Development - XamarinDeepu S Nath
 

More from Deepu S Nath (20)

Design Thinking, Critical Thinking & Innovation Design
Design Thinking, Critical Thinking & Innovation DesignDesign Thinking, Critical Thinking & Innovation Design
Design Thinking, Critical Thinking & Innovation Design
 
GTECH ATFG µLearn Framework Intro
GTECH ATFG µLearn Framework IntroGTECH ATFG µLearn Framework Intro
GTECH ATFG µLearn Framework Intro
 
Future of learning - Technology Disruption
Future of learning  - Technology DisruptionFuture of learning  - Technology Disruption
Future of learning - Technology Disruption
 
Decentralized Applications using Ethereum
Decentralized Applications using EthereumDecentralized Applications using Ethereum
Decentralized Applications using Ethereum
 
How machines can take decisions
How machines can take decisionsHow machines can take decisions
How machines can take decisions
 
Artificial Intelligence: An Introduction
 Artificial Intelligence: An Introduction Artificial Intelligence: An Introduction
Artificial Intelligence: An Introduction
 
FAYA PORT 80 Introduction
FAYA PORT 80 IntroductionFAYA PORT 80 Introduction
FAYA PORT 80 Introduction
 
How machines can take decisions
How machines can take decisionsHow machines can take decisions
How machines can take decisions
 
Simplified Introduction to AI
Simplified Introduction to AISimplified Introduction to AI
Simplified Introduction to AI
 
Mining Opportunities of Block Chain and BitCoin
Mining Opportunities of Block Chain and BitCoinMining Opportunities of Block Chain and BitCoin
Mining Opportunities of Block Chain and BitCoin
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
Coffee@DBG - TechBites March 2016
Coffee@DBG - TechBites March 2016Coffee@DBG - TechBites March 2016
Coffee@DBG - TechBites March 2016
 
SEO For Developers
SEO For DevelopersSEO For Developers
SEO For Developers
 
Life Cycle of an App - From Idea to Monetization
Life Cycle of an App - From Idea to Monetization  Life Cycle of an App - From Idea to Monetization
Life Cycle of an App - From Idea to Monetization
 
Uncommon Python - What is special in Python
Uncommon Python -  What is special in PythonUncommon Python -  What is special in Python
Uncommon Python - What is special in Python
 
Coffee@DBG - TechBites Sept 2015
Coffee@DBG - TechBites Sept 2015Coffee@DBG - TechBites Sept 2015
Coffee@DBG - TechBites Sept 2015
 
Techbites July 2015
Techbites July 2015Techbites July 2015
Techbites July 2015
 
Apple Watch - Start Your Developer Engine
Apple Watch -  Start Your Developer EngineApple Watch -  Start Your Developer Engine
Apple Watch - Start Your Developer Engine
 
Greetings & Response - English Communication Training
Greetings & Response - English Communication TrainingGreetings & Response - English Communication Training
Greetings & Response - English Communication Training
 
Hybrid Mobile App Development - Xamarin
Hybrid Mobile App Development - XamarinHybrid Mobile App Development - Xamarin
Hybrid Mobile App Development - Xamarin
 

Recently uploaded

Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
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
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
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
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
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
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
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 Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 

Recently uploaded (20)

Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
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...
 
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...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
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
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
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 Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

REACT.JS : Rethinking UI Development Using JavaScript

  • 1. REACT.JS RETHINKING UI DEVELOPMENT WITH JAVASCRIPT Introduction
  • 2. Agenda Overview Components JSX Data for component The component lifecycle Component Methods Component Breakdown React v0.14 Flux (Intro)
  • 5. ❖ Implements a virtual DOM ❖ Allows us to render components super fast ❖ Removes any unnecessary overhead from DOM operations ❖ Deal with the "V" of any MVC framework
  • 6. ❖ Implements a virtual DOM ❖ Allows us to render components super fast ❖ Removes any unnecessary overhead from DOM operations ❖ Deal with the "V" of any MVC framework
  • 7. ❖ Implements a virtual DOM ❖ Allows us to render components super fast ❖ Removes any unnecessary overhead from DOM operations ❖ Deal with the "V" of any MVC framework “The way we are able to figure this out is that React does not manipulate the DOM unless it needs to. It uses a fast, internal mock DOM to perform diffs and computes the most efficient DOM mutation for you.” - React Doc
  • 8. ❖ Implements a virtual DOM ❖ Allows us to render components super fast ❖ Removes any unnecessary overhead from DOM operations ❖ Deal with the "V" of any MVC framework var msg = 'Bad'; $userMsg.html( '<p>I love Breaking ' + msg ); var data = { 'user_id' : 13, 'user_name' : 'W.W', 'user_msg' : 'I am the one who knocks!' }; $chatList.append( [ '<li class="chat__msg-wrap">', '<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>', '<span class="chat__user-name">' + data.user_name + '</span>', '<span class="chat__user-msg">' + data.user_msg + '</span>', '</li>' ].join(); );
  • 9. ❖ Implements a virtual DOM ❖ Allows us to render components super fast ❖ Removes any unnecessary overhead from DOM operations ❖ Deal with the "V" of any MVC framework var msg = 'Bad'; $userMsg.html( '<p>I love Breaking ' + msg ); var data = { 'user_id' : 13, 'user_name' : 'W.W', 'user_msg' : 'I am the one who knocks!' }; $chatList.append( [ '<li class="chat__msg-wrap">', '<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>', '<span class="chat__user-name">' + data.user_name + '</span>', '<span class="chat__user-msg">' + data.user_msg + '</span>', '</li>' ].join(); );
  • 10. ❖ Implements a virtual DOM ❖ Allows us to render components super fast ❖ Removes any unnecessary overhead from DOM operations ❖ Deal with the "V" of any MVC framework
  • 11. ❖ Implements a virtual DOM ❖ Allows us to render components super fast ❖ Removes any unnecessary overhead from DOM operations ❖ Deal with the "V" of any MVC framework
  • 12. ❖ Implements a virtual DOM ❖ Allows us to render components super fast ❖ Removes any unnecessary overhead from DOM operations ❖ Deal with the "V" of any MVC framework
  • 13.
  • 16. ❖ Each component is contained in its own "scope" ❖ Define the functionality and reuse it as many times ❖ Has a render function, which returns the HTML the component will render in the browser ❖ We can call other React component's too
  • 17. ❖ Each component is contained in its own "scope" ❖ Define the functionality and reuse it as many times ❖ Has a render function, which returns the HTML the component will render in the browser ❖ We can call other React component's too
  • 18. ❖ Each component is contained in its own "scope" ❖ Define the functionality and reuse it as many times ❖ Has a render function, which returns the HTML the component will render in the browser ❖ We can call other React component's too
  • 19. ❖ Each component is contained in its own "scope" ❖ Define the functionality and reuse it as many times ❖ Has a render function, which returns the HTML the component will render in the browser ❖ We can call other React component's too
  • 20. ❖ Each component is contained in its own "scope" ❖ Define the functionality and reuse it as many times ❖ Has a render function, which returns the HTML the component will render in the browser ❖ We can call other React component's too
  • 21. JSX
  • 23. ❖ Write HTML inside of Javascript without having to wrap strings around it ❖ We don't have to worry about strings and multiple lines etc ❖ Transform the JSX in the browser on runtime - not recommended as it slows down your page ❖ Both gulp and grunt offer a JSX transformer
  • 24. ❖ Write HTML inside of Javascript without having to wrap strings around it ❖ We don't have to worry about strings and multiple lines etc ❖ Transform the JSX in the browser on runtime - not recommended as it slows down your page ❖ Both gulp and grunt offer a JSX transformer
  • 25. ❖ Write HTML inside of Javascript without having to wrap strings around it ❖ We don't have to worry about strings and multiple lines etc ❖ Transform the JSX in the browser on runtime - not recommended as it slows down your page ❖ Both gulp and grunt offer a JSX transformer
  • 26. $chatList.append( '<li class="chat__msg-wrap"> <img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/> <span class="chat__user-name">' + data.user_name + '</span> <span class="chat__user-msg">' + data.user_msg + '</span> </li>' ); $chatList.append( '<li class="chat__msg-wrap">' + '<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>' + '<span class="chat__user-name">' + data.user_name + '</span>' + '<span class="chat__user-msg">' + data.user_msg + '</span>' + '</li>' ); $chatList.append( [ '<li class="chat__msg-wrap">', '<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>', '<span class="chat__user-name">' + data.user_name + '</span>', '<span class="chat__user-msg">' + data.user_msg + '</span>', '</li>' ].join(); );
  • 27. $chatList.append( '<li class="chat__msg-wrap"> <img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/> <span class="chat__user-name">' + data.user_name + '</span> <span class="chat__user-msg">' + data.user_msg + '</span> </li>' ); $chatList.append( '<li class="chat__msg-wrap">' + '<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>' + '<span class="chat__user-name">' + data.user_name + '</span>' + '<span class="chat__user-msg">' + data.user_msg + '</span>' + '</li>' ); $chatList.append( [ '<li class="chat__msg-wrap">', '<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>', '<span class="chat__user-name">' + data.user_name + '</span>', '<span class="chat__user-msg">' + data.user_msg + '</span>', '</li>' ].join(); );
  • 28. $chatList.append( '<li class="chat__msg-wrap"> <img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/> <span class="chat__user-name">' + data.user_name + '</span> <span class="chat__user-msg">' + data.user_msg + '</span> </li>' ); $chatList.append( '<li class="chat__msg-wrap">' + '<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>' + '<span class="chat__user-name">' + data.user_name + '</span>' + '<span class="chat__user-msg">' + data.user_msg + '</span>' + '</li>' ); $chatList.append( [ '<li class="chat__msg-wrap">', '<img class="chat__user-img" src="' + getUserImg(data.user_id) + '"/>', '<span class="chat__user-name">' + data.user_name + '</span>', '<span class="chat__user-msg">' + data.user_msg + '</span>', '</li>' ].join(); );
  • 29. ❖ Write HTML inside of Javascript without having to wrap strings around it ❖ We don't have to worry about strings and multiple lines etc ❖ Transform the JSX in the browser on runtime - not recommended as it slows down your page ❖ Both gulp and grunt offer a JSX transformer
  • 30. ❖ Write HTML inside of Javascript without having to wrap strings around it ❖ We don't have to worry about strings and multiple lines etc ❖ Transform the JSX in the browser on runtime - not recommended as it slows down your page ❖ Both gulp and grunt offer a JSX transformer
  • 32. var ExampleComponent = React.createClass({ render: function () { return ( <div className="navigation"> Hello World! </div> ); } });
  • 33. var ExampleComponent = React.createClass({ render: function () { return ( React.createElement('div', {className: 'navigation'}, 'Hello World!') ); } }); ❖ You don't have to use JSX ❖ Using className since class is a reserved word in Javascript ❖ JSX transforms the code, changes all the attributes on the node into an object
  • 34. Using variables for attributes
  • 35. var ExampleComponent = React.createClass({ render: function () { var navigationClass = 'navigation'; return ( <div className={ navigationClass }> Hello World! </div> ); } }); ❖ Dynamically change the class of a component ❖ Wrap it around a set of curly braces, so JSX knows that it is an external variable
  • 37. var ExampleComponent = React.createClass({ render: function () { var navigationClass = 'navigation'; return ( <div className={ navigationClass }> Hello World! </div> ); } }); ReactDOM.render( <ExampleComponent />, document.body ); ❖ Tell React which component to render, and point to an existing DOM node for where to render it
  • 40. Props
  • 41. ❖ Props is the data passed into a component ❖ Props is accessed via “this.props” ❖ Props is immutable, don’t change only use
  • 42. ❖ Props is the data passed into a component ❖ Props is accessed via “this.props” ❖ Props is immutable, don’t change only use
  • 43. ❖ Props is the data passed into a component ❖ Props is accessed via “this.props” ❖ Props is immutable, don’t change only use
  • 44. ❖ Props is the data passed into a component ❖ Props is accessed via “this.props” ❖ Props is immutable, don’t change only use
  • 45. var SayMyName = React.createClass({ render: function () { return ( <div className="say-hello"> Hello { this.props.name } </div> ); } }); var myName = 'Heisenberg'; ReactDOM.render(<SayMyName name={ myName } />, document.body);
  • 46. var SayMyName = React.createClass({ render: function () { return ( <div className="say-hello"> Hello { this.props.name } </div> ); } }); var myName = 'Heisenberg'; ReactDOM.render(<SayMyName name={ myName } />, document.body);
  • 47. var SayMyName = React.createClass({ render: function () { return ( <div className="say-hello"> Hello { this.props.name } </div> ); } }); var myName = 'Heisenberg'; ReactDOM.render(<SayMyName name={ myName } />, document.body);
  • 48. State
  • 49. ❖ State is the private data within each instance of components ❖ State is accessed via “this.state” ❖ State is mutable, do whatever we want ❖ Usually we hook those data into state that represent UI ❖ Changing state will re-render UI
  • 50. ❖ State is the private data within each instance of components ❖ State is accessed via “this.state” ❖ State is mutable, do whatever we want ❖ Usually we hook those data into state that represent UI ❖ Changing state will re-render UI
  • 51. ❖ State is the private data within each instance of components ❖ State is accessed via “this.state” ❖ State is mutable, do whatever we want ❖ Usually we hook those data into state that represent UI ❖ Changing state will re-render UI
  • 52. ❖ State is the private data within each instance of components ❖ State is accessed via “this.state” ❖ State is mutable, do whatever we want ❖ Usually we hook those data into state that represent UI ❖ Changing state will re-render UI
  • 53. ❖ State is the private data within each instance of components ❖ State is accessed via “this.state” ❖ State is mutable, do whatever we want ❖ Usually we hook those data into state that represent UI ❖ Changing state will re-render UI
  • 54. ❖ State is the private data within each instance of components ❖ State is accessed via “this.state” ❖ State is mutable, do whatever we want ❖ Usually we hook those data into state that represent UI ❖ Changing state will re-render UI
  • 55. var SayMyName = React.createClass({ getInitalState: function () { return { greet: 'Hello' } }, render: function () { return ( <div className="say-hello"> { this.state.greet } { this.props.name } </div> ); } }); var myName = 'Heisenberg'; ReactDOM.render(<SayMyName name={ myName } />, document.body);
  • 56. var SayMyName = React.createClass({ getInitalState: function () { return { greet: 'Hello' } }, render: function () { return ( <div className="say-hello"> { this.state.greet } { this.props.name } </div> ); } }); var myName = 'Heisenberg'; ReactDOM.render(<SayMyName name={ myName } />, document.body);
  • 57. var SayMyName = React.createClass({ getInitalState: function () { return { greet: 'Hello' } }, render: function () { return ( <div className="say-hello"> { this.state.greet } { this.props.name } </div> ); } }); var myName = 'Heisenberg'; ReactDOM.render(<SayMyName name={ myName } />, document.body);
  • 59. getInitialState only called once, and is called as the component is being mounted.
  • 60. componentWillMount As soon as your component is about to be mounted, this is called.
  • 61. var ExampleComponent = React.createClass({ componentWillMount: function () { // hide any loading screens // remove any placeholders }, render: function () { // this gets called many times in a components life return ( <div> Hello World! </div> ); } });
  • 62. componentDidMount Once your component has ran the render function and actually rendered your component in the DOM
  • 63. var ExampleComponent = React.createClass({ componentDidMount: function () { // render a chart on the DOM node // bind events to window, like resize }, render: function () { return ( <div> Hello World! </div> ); } });
  • 64. componentWillUnmount If you were to remove the component from the DOM, this function is called
  • 65. var ExampleComponent = React.createClass({ componentWillUnmount: function () { // unbind events to window, like resize }, render: function () { return ( <div> Hello World! </div> ); } });
  • 67. getDefaultProps Define the default values for the properties of the component that we are expecting
  • 68. var Navigation = React.createClass({ getDefaultProps: function () { return { nav: {} } }, render: function () { return ( <ul className="navigation">...</ul> ); } }); ReactDOM.render( <Navigation nav={ navObj } />, $header ); ReactDOM.render( <Navigation />, $footer );
  • 69. propTypes Specify the type of each property we are expecting for validation. Checked only in development mode.
  • 70. var Navigation = React.createClass({ propTypes: { nav : React.PropTypes.object, data : React.PropTypes.array }, render: function () { return ( <ul className="navigation">...</ul> ); } }); ReactDOM.render( <Navigation nav={ navObj } />, $header );
  • 71. mixins So we don't have to write the same code twice
  • 72. var ExampleMixin = { componentDidMount: function () { // bind resize event on window }, componentWillUnmount: function () { // unbind resize event from window } }; var ExampleComponent = React.createClass({ mixins: [ExampleMixin] }); var AnotherComponent = React.createClass({ mixins: [ExampleMixin] });
  • 73. Loop de loop Looping through data in array of objects
  • 74. var Navigation = React.createClass({ render: function () { var items = this.props.nav.map(function (item) { return ( <li className="navigation__item"> <a className="navigation__link" href={ item.href }> { item.text } </a> </li> ); }); return ( <ul className="navigation"> { items } </ul> ); } }); var navObj = [{ href: 'http://vijaydev.com', text: 'My Website' }]; ReactDOM.render( <Navigation nav={ navObj } />, $header );
  • 75. var Navigation = React.createClass({ render: function () { var items = this.props.nav.map(function (item) { return ( <li className="navigation__item"> <a className="navigation__link" href={ item.href }> { item.text } </a> </li> ); }); return ( <ul className="navigation"> { items } </ul> ); } }); var navObj = [{ href: 'http://vijaydev.com', text: 'My Website' }]; ReactDOM.render( <Navigation nav={ navObj } />, $header );
  • 76. var Navigation = React.createClass({ render: function () { var items = this.props.nav.map(function (item) { return ( <li className="navigation__item"> <a className="navigation__link" href={ item.href }> { item.text } </a> </li> ); }); return ( <ul className="navigation"> { items } </ul> ); } }); var navObj = [{ href: 'http://vijaydev.com', text: 'My Website' }]; ReactDOM.render( <Navigation nav={ navObj } />, $header );
  • 77. var NavItem = React.createClass({ render: function () { return ( <li className="navigation__item"> <a className="navigation__link" href={ this.props.href }> { this.props.text } </a> </li> ); } }); var Navigation = React.createClass({ render: function () { var items = this.props.nav.map(function (item) { return ( <NavItem href={ item.href } text={ item.text } /> ); }); return ( <ul className="navigation">{ items }</ul> ); } });
  • 78. var NavItem = React.createClass({ render: function () { return ( <li className="navigation__item"> <a className="navigation__link" href={ this.props.href }> { this.props.text } </a> </li> ); } }); var Navigation = React.createClass({ render: function () { var items = this.props.nav.map(function (item) { return ( <NavItem href={ item.href } text={ item.text } /> ); }); return ( <ul className="navigation">{ items }</ul> ); } });
  • 79. var NavItem = React.createClass({ render: function () { return ( <li className="navigation__item"> <a className="navigation__link" href={ this.props.href }> { this.props.text } </a> </li> ); } }); var Navigation = React.createClass({ render: function () { var items = this.props.nav.map(function (item) { return ( <NavItem href={ item.href } text={ item.text } /> ); }); return ( <ul className="navigation">{ items }</ul> ); } });
  • 81. UI to reusable components Case study: How to breakdown UI into various reusable components
  • 82.
  • 83. data = [{ 'src' : '/path/to/image', 'alt' : 'alt text of image', 'title' : 'name of the movie', 'href' : '/path/to/the/movie/details/page', 'cast' : ['array', 'of', 'movie', 'casts'], 'rating' : 'movie rating', 'theater_href' : '/path/to/theater/list' }, { ... ... }, { ... ... }];
  • 84. props = [{ 'src' : '/path/to/image', 'alt' : 'alt text of image', 'title' : 'name of the movie', 'href' : '/path/to/the/movie/details/page', 'cast' : ['array', 'of', 'movie', 'casts'], 'rating' : 'movie rating', 'theater_href' : '/path/to/theater/list' }, {...}, {...}]; state = { 'actualData' : this.props, 'currWidth' : 'calculated current screen width', 'colCount' : 'based on currWidth & max column count', 'perPage' : 'based on currWidth & colCount', 'totalPages' : 'based on perPage & actualData length', 'currPageNo' : 'used in calculating pageData', 'pageData' : 'based on totalPages & currPageNo' };
  • 85. <MoviePosterContent> <MoviePosterList data={ this.state.pageData }> <PosterItem data={ pageData[i] }> <PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } /> <PosterRatingTheater data={ iRating, itheaterHref } /> </PosterItem> </MoviePosterList> <Navigation data={ this.state.totalPages, this.state.currPageNo } /> </MoviePosterContent> ReactDOM.render(<MoviePosterContent data={ data } />, $domNode); <MoviePosterContent> <MoviePosterList data={ this.state.pageData }> <PosterItem data={ pageData[i] }> <PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } /> <PosterRatingTheater data={ iRating, itheaterHref } /> </PosterItem> </MoviePosterList> <Navigation data={ this.state.totalPages, this.state.currPageNo } /> </MoviePosterContent> ReactDOM.render( <MoviePosterContent data={ data } />, $domNode );
  • 86. <MoviePosterContent> <MoviePosterList data={ this.state.pageData }> <PosterItem data={ pageData[i] }> <PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } /> <PosterRatingTheater data={ iRating, itheaterHref } /> </PosterItem> </MoviePosterList> <Navigation data={ this.state.totalPages, this.state.currPageNo } /> </MoviePosterContent> ReactDOM.render(<MoviePosterContent data={ data } />, $domNode); <MoviePosterContent> <MoviePosterList data={ this.state.pageData }> <PosterItem data={ pageData[i] }> <PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } /> <PosterRatingTheater data={ iRating, itheaterHref } /> </PosterItem> </MoviePosterList> <Navigation data={ this.state.totalPages, this.state.currPageNo } /> </MoviePosterContent> ReactDOM.render( <MoviePosterContent data={ data } />, $domNode ); props = [{ 'src' : '/path/to/image', 'alt' : 'alt text of image', 'title' : 'name of the movie', 'href' : '/path/to/the/movie/details/page', 'cast' : ['array', 'of', 'movie', 'casts'], 'rating' : 'movie rating', 'theater_href' : '/path/to/theater/list' }, {...}, {...}]; state = { 'actualData' : this.props, 'currWidth' : 'calculated current screen width', 'colCount' : 'based on currWidth & max column count', 'perPage' : 'based on currWidth & colCount', 'totalPages' : 'based on perPage & actualData length', 'currPageNo' : 'used in calculating pageData', 'pageData' : 'based on totalPages & currPageNo' };
  • 87. <MoviePosterContent> <MoviePosterList data={ this.state.pageData }> <PosterItem data={ pageData[i] }> <PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } /> <PosterRatingTheater data={ iRating, itheaterHref } /> </PosterItem> </MoviePosterList> <Navigation data={ this.state.totalPages, this.state.currPageNo } /> </MoviePosterContent> ReactDOM.render(<MoviePosterContent data={ data } />, $domNode); <MoviePosterContent> <MoviePosterList data={ this.state.pageData }> <PosterItem data={ pageData[i] }> <PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } /> <PosterRatingTheater data={ iRating, itheaterHref } /> </PosterItem> </MoviePosterList> <Navigation data={ this.state.totalPages, this.state.currPageNo } /> </MoviePosterContent> ReactDOM.render( <MoviePosterContent data={ data } />, $domNode );
  • 88. <MoviePosterContent> <MoviePosterList data={ this.state.pageData }> <PosterItem data={ pageData[i] }> <PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } /> <PosterRatingTheater data={ iRating, itheaterHref } /> </PosterItem> </MoviePosterList> <Navigation data={ this.state.totalPages, this.state.currPageNo } /> </MoviePosterContent> ReactDOM.render(<MoviePosterContent data={ data } />, $domNode); <MoviePosterContent> <MoviePosterList data={ this.state.pageData }> <PosterItem data={ pageData[i] }> <PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } /> <PosterRatingTheater data={ iRating, itheaterHref } /> </PosterItem> </MoviePosterList> <Navigation data={ this.state.totalPages, this.state.currPageNo } /> </MoviePosterContent> ReactDOM.render( <MoviePosterContent data={ data } />, $domNode ); props = [{ 'src' : '/path/to/image', 'alt' : 'alt text of image', 'title' : 'name of the movie', 'href' : '/path/to/the/movie/details/page', 'cast' : ['array', 'of', 'movie', 'casts'], 'rating' : 'movie rating', 'theater_href' : '/path/to/theater/list' }, {...}, {...}]; state = { 'actualData' : this.props, 'currWidth' : 'calculated current screen width', 'colCount' : 'based on currWidth & max column count', 'perPage' : 'based on currWidth & colCount', 'totalPages' : 'based on perPage & actualData length', 'currPageNo' : 'used in calculating pageData', 'pageData' : 'based on totalPages & currPageNo' };
  • 89. <MoviePosterContent> <MoviePosterList data={ this.state.pageData }> <PosterItem data={ pageData[i] }> <PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } /> <PosterRatingTheater data={ iRating, itheaterHref } /> </PosterItem> </MoviePosterList> <Navigation data={ this.state.totalPages, this.state.currPageNo } /> </MoviePosterContent> ReactDOM.render(<MoviePosterContent data={ data } />, $domNode); <MoviePosterContent> <MoviePosterList data={ this.state.pageData }> <PosterItem data={ pageData[i] }> <PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } /> <PosterRatingTheater data={ iRating, itheaterHref } /> </PosterItem> </MoviePosterList> <Navigation data={ this.state.totalPages, this.state.currPageNo } /> </MoviePosterContent> ReactDOM.render( <MoviePosterContent data={ data } />, $domNode );
  • 90. <MoviePosterContent> <MoviePosterList data={ this.state.pageData }> <PosterItem data={ pageData[i] }> <PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } /> <PosterRatingTheater data={ iRating, itheaterHref } /> </PosterItem> </MoviePosterList> <Navigation data={ this.state.totalPages, this.state.currPageNo } /> </MoviePosterContent> ReactDOM.render(<MoviePosterContent data={ data } />, $domNode); <MoviePosterContent> <MoviePosterList data={ this.state.pageData }> <PosterItem data={ pageData[i] }> <PosterNameCasts data={ iSrc, iAlt, iTitle, iHref, iCast } /> <PosterRatingTheater data={ iRating, itheaterHref } /> </PosterItem> </MoviePosterList> <Navigation data={ this.state.totalPages, this.state.currPageNo } /> </MoviePosterContent> ReactDOM.render( <MoviePosterContent data={ data } />, $domNode ); props = [{ 'src' : '/path/to/image', 'alt' : 'alt text of image', 'title' : 'name of the movie', 'href' : '/path/to/the/movie/details/page', 'cast' : ['array', 'of', 'movie', 'casts'], 'rating' : 'movie rating', 'theater_href' : '/path/to/theater/list' }, {...}, {...}]; state = { 'actualData' : this.props, 'currWidth' : 'calculated current screen width', 'colCount' : 'based on currWidth & max column count', 'perPage' : 'based on currWidth & colCount', 'totalPages' : 'based on perPage & actualData length', 'currPageNo' : 'used in calculating pageData', 'pageData' : 'based on totalPages & currPageNo' };
  • 92. ❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three” ❖ Deprecated: “react-tools” package and “JSXTransform.js” ❖ React namespace split into React and ReactDOM ❖ React keep core functionalities for creating components ❖ ReactDOM for rendering in DOM React.render(<SayMyName name={ myName } />, document.body); ReactDOM.render(<SayMyName name={ myName } />, document.body);
  • 93. ❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three” ❖ Deprecated: “react-tools” package and “JSXTransform.js” ❖ React namespace split into React and ReactDOM ❖ React keep core functionalities for creating components ❖ ReactDOM for rendering in DOM React.render(<SayMyName name={ myName } />, document.body); ReactDOM.render(<SayMyName name={ myName } />, document.body);
  • 94. ❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three” ❖ Deprecated: “react-tools” package and “JSXTransform.js” ❖ React namespace split into React and ReactDOM ❖ React keep core functionalities for creating components ❖ ReactDOM for rendering in DOM React.render(<SayMyName name={ myName } />, document.body); ReactDOM.render(<SayMyName name={ myName } />, document.body); “This paves the way to writing components that can be shared between the web version of React and React Native. We don’t expect all the code in an app to be shared, but we want to be able to share the components that do behave the same across platforms.” - React v0.14 release blog
  • 95. ❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three” ❖ Deprecated: “react-tools” package and “JSXTransform.js” ❖ React namespace split into React and ReactDOM ❖ React keep core functionalities for creating components ❖ ReactDOM for rendering in DOM React.render(<SayMyName name={ myName } />, document.body); ReactDOM.render(<SayMyName name={ myName } />, document.body);
  • 96. ❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three” ❖ Deprecated: “react-tools” package and “JSXTransform.js” ❖ React namespace split into React and ReactDOM ❖ React keep core functionalities for creating components ❖ ReactDOM for rendering in DOM React.render(<SayMyName name={ myName } />, document.body); ReactDOM.render(<SayMyName name={ myName } />, document.body);
  • 97. ❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three” ❖ Deprecated: “react-tools” package and “JSXTransform.js” ❖ React namespace split into React and ReactDOM ❖ React keep core functionalities for creating components ❖ ReactDOM for rendering in DOM React.render(<SayMyName name={ myName } />, document.body); ReactDOM.render(<SayMyName name={ myName } />, document.body);
  • 98. ❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three” ❖ Deprecated: “react-tools” package and “JSXTransform.js” ❖ React namespace split into React and ReactDOM ❖ React keep core functionalities for creating components ❖ ReactDOM for rendering in DOM React.render(<SayMyName name={ myName } />, document.body); ReactDOM.render(<SayMyName name={ myName } />, document.body); “...it has become clear that the beauty and essence of React has nothing to do with browsers or the DOM.” - React v0.14 release blog
  • 99. ❖ Enter “React Native”, and also - “React Art”, “React Canvas” and “React Three” ❖ Deprecated: “react-tools” package and “JSXTransform.js” ❖ React namespace split into React and ReactDOM ❖ React keep core functionalities for creating components ❖ ReactDOM for rendering in DOM React.render(<SayMyName name={ myName } />, document.body); ReactDOM.render(<SayMyName name={ myName } />, document.body);
  • 100. Flux
  • 101.
  • 102. pageData: [ {'Puthiya Niyamam', ...}, {'Maheshinte Prathikaaram', ...}, {'Action Hero Biju', ...}, {'Mastizaade', ...} ] pageData: [ {'Pachakallam', ...}, {'Jalam', ...}, {'Airlift', ...}, {'Kya Kool Hai Hum', ...} ]
  • 103.
  • 104.
  • 105. { type: 'NEXT_BTN_PRESS' } { type: 'PREV_BTN_PRESS' } { type: 'JUMP_TO_PAGE', payload: { 'pageNo': 3 } } { type: 'WINDOW_RESIZED', payload: { 'newWidth': 600 } } { type: 'ADD_TODO', payload: { text: 'Learn ES6' } }
  • 106. { type: 'NEXT_BTN_PRESS' } { type: 'PREV_BTN_PRESS' } { type: 'JUMP_TO_PAGE', payload: { 'pageNo': 3 } } { type: 'WINDOW_RESIZED', payload: { 'newWidth': 600 } } { type: 'ADD_TODO', payload: { text: 'Learn ES6' } }
  • 107. { type: 'NEXT_BTN_PRESS' } { type: 'PREV_BTN_PRESS' } { type: 'JUMP_TO_PAGE', payload: { 'pageNo': 3 } } { type: 'WINDOW_RESIZED', payload: { 'newWidth': 600 } } { type: 'ADD_TODO', payload: { text: 'Learn ES6' } }
  • 108.
  • 110. Vijay Dev Lead Front-end Engineer http://vijaydev.com/