SlideShare a Scribd company logo
ReactJS
A Web Library for web
development
By George Tony
History Created By Jordan Walke, Facebook
Influenced by XHP, an HTML component
framework for PHP
Open Source on 2013
Released React Native for IOS and android
development in React on 2015
React and React native are top two stared open
sourced project of facebook.
React is 6th most starred project( Star : 52k, Fork
: 9k )
Introduction
Written in JSX
Supports ES6(ECMAScript 6).
Classes ,arrow function … support
comes to React with ES6.
Can create reusable Components
<HelloWorld/>
<div> Hello World </div>
Unidirectional.
Virtual DOM to detect Changes.
JSX and ES6
JSX is a preprocessor step that adds XML syntax to JavaScript.
ES6 new standard for Javascript which give support for much needed classes
etc.
Compilers are used to convert JSX files to javascript for web browser.
Reusable Component.
Componet in React are like Html tag
Eg <input>
Link fo support html tag.
All the html tag are supported by the react.
Give ability to create New Component with existing ones
Events Handlers.
Html event like click, focus, hover are handled by the event handler in React
Eg <input value={this.state.value} onChange={ e => this.setState( { value : e.target.value })}/>
Console of react Component
console.log(this)
{
“props” : { ... }, // all the attribute of react component
“state” : {... }, // all state variable in hash
“refs” : {...}, // all reference to child components
render(){...}, // render function
component*(){..} // Life cycle function
….. // other user defined function
}
React special attributes
Key
Used to map array of child node
className
Used to give css classname
Style
Inline style to react element
Hash of key-value pairs
Ref
<ul className=”list” ref=”listItem”>
<li key=1 style={style1}>
1
</li>
<li key=2 style={style2}>
2
</li>
</ul>
React Architecture
React
Component
Virtual Dom
Browser Dom
Inter
Communicating
Components
Virtual Dom
Detecting DOM
changes to apply
to Browser DOM
DOM
changes
to Virtual
Dom
Browser
Rerenders
Creating Components
Main Comparts of React Component:
State, props,render function.
State : a Hash key where all state information about a React component are
stored.
Eg {
“Props” : { ….},
Render(){},
“State” : {
“Name” : “tony”,
“Team”: “foss”
}
}
Props:
List all tag and attributes passed to web component.
Eg. <HelloWorld value=”Hello World”/>
{
“Props” : {
“Value” : “Hello World”
}
“State” :{},
Render(){}
}
Render function: Function return what to output to web browser.
Eg render(){
Return (
<div>
<p> Hello World </p>
</div>
)
}
Render function is called when state variable is changed by using this.setState
method.
Rendering Component for small change with state that has no effect UI is
expensive to Avoid this we use function shouldComponentUpdate.More
about this will cover in Component Life Cycle.
React Virtual Dom
React is Unidirectional.
If anyone want to modify html element in the browser . It has to be through
React Only.
If any modification from outside react will be overwritten by React on Next Dom
Modification.
React checks if there any for diff b/w Browser Dom in its Memory and Virtual
DOM. Any Changes is applied to browser.
Example
Browser
<ul>
<li>1</li>
<li>2</li>
</ul
Virual Dom
<ul>
<li>1</li
>
<li>3</li>
</ul>
Changes applied.
Browser changes Text 2 changed to 3 for 2nd
Child of ul element.
Constructor
Constructor to React Class.
Argument for constructor is props
you should call super(props) before any other statement. Otherwise, this.props will be undefined in the
constructor, which can lead to bugs.
The constructor is the right place to initialize state. If you don't initialize state and you don't bind
methods, you don't need to implement a constructor for your React component.
constructor(props) {
super(props);
this.state = {
color: props.initialColor
Component Life Cycle
componentWillMount
componentDidMount
componentWillRecieveProps
shouldComponentUpdate
componentWillUpdate
componentDidUpdate
componentWillUnmount
ComponentWillMount
This function is invoked before initial render.
If setState is used in this function . Render function execute with new state.
ComponentDidMount
Called after initial render.
At this state all the reference to component can be set properly.
Integration to Other JS Library is done here with timeout functions.
ComponentWillReceiveProps
This function is called whenever Props to component is changed.
setState will create additional render in this function.
Argument newProps
ShouldComponentUpdate
Decision to re render or not ?
Returns Boolean
True : Component re render.
False: component skip render.
Effective for state change which does not involve UI changes
Argument to this newState,newProps
ComponentWillUpdate
Preparing Component For updating.
Argument newState, newProps
componentDidUpdate
Called After re render.
Similar to componentDidMount.
Argument oldState, oldProps
ComponentWillUnmount
Called before component gets removed from Dom
Cleaning reference and changes done by external Library in
componentDidUpdate and componentDidMount
Class Property
defaultProps
defaultProps = { name : “g”}
propTypes
propTypes = { name : React.PropTypes.string }
Ad

More Related Content

What's hot (20)

Intro to React
Intro to ReactIntro to React
Intro to React
Eric Westfall
 
React render props
React render propsReact render props
React render props
Saikat Samanta
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
Arnold Asllani
 
React js t1 - introduction
React js   t1 - introductionReact js   t1 - introduction
React js t1 - introduction
Jainul Musani
 
Introduction to React JS for beginners | Namespace IT
Introduction to React JS for beginners | Namespace ITIntroduction to React JS for beginners | Namespace IT
Introduction to React JS for beginners | Namespace IT
namespaceit
 
React workshop
React workshopReact workshop
React workshop
Imran Sayed
 
Deep Dive Into Repository - Android Architecture Components
Deep Dive Into Repository - Android Architecture ComponentsDeep Dive Into Repository - Android Architecture Components
Deep Dive Into Repository - Android Architecture Components
Somkiat Khitwongwattana
 
Dependency Inversion in large-scale TypeScript applications with InversifyJS
Dependency Inversion in large-scale TypeScript applications with InversifyJSDependency Inversion in large-scale TypeScript applications with InversifyJS
Dependency Inversion in large-scale TypeScript applications with InversifyJS
Remo Jansen
 
Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react js
StephieJohn
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.js
Emanuele DelBono
 
Reproducible component tests using docker
Reproducible component tests using dockerReproducible component tests using docker
Reproducible component tests using docker
Pavel Rabetski
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥
Remo Jansen
 
React hooks Episode #1: An introduction.
React hooks Episode #1: An introduction.React hooks Episode #1: An introduction.
React hooks Episode #1: An introduction.
ManojSatishKumar
 
React and Flux life cycle with JSX, React Router and Jest Unit Testing
React and  Flux life cycle with JSX, React Router and Jest Unit TestingReact and  Flux life cycle with JSX, React Router and Jest Unit Testing
React and Flux life cycle with JSX, React Router and Jest Unit Testing
Eswara Kumar Palakollu
 
Workshop 22: React-Redux Middleware
Workshop 22: React-Redux MiddlewareWorkshop 22: React-Redux Middleware
Workshop 22: React-Redux Middleware
Visual Engineering
 
Redux workshop
Redux workshopRedux workshop
Redux workshop
Imran Sayed
 
React js
React jsReact js
React js
Jai Santhosh
 
React and redux
React and reduxReact and redux
React and redux
Mystic Coders, LLC
 
React js
React jsReact js
React js
Alireza Akbari
 
React js t6 -lifecycle
React js   t6 -lifecycleReact js   t6 -lifecycle
React js t6 -lifecycle
Jainul Musani
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
Arnold Asllani
 
React js t1 - introduction
React js   t1 - introductionReact js   t1 - introduction
React js t1 - introduction
Jainul Musani
 
Introduction to React JS for beginners | Namespace IT
Introduction to React JS for beginners | Namespace ITIntroduction to React JS for beginners | Namespace IT
Introduction to React JS for beginners | Namespace IT
namespaceit
 
Deep Dive Into Repository - Android Architecture Components
Deep Dive Into Repository - Android Architecture ComponentsDeep Dive Into Repository - Android Architecture Components
Deep Dive Into Repository - Android Architecture Components
Somkiat Khitwongwattana
 
Dependency Inversion in large-scale TypeScript applications with InversifyJS
Dependency Inversion in large-scale TypeScript applications with InversifyJSDependency Inversion in large-scale TypeScript applications with InversifyJS
Dependency Inversion in large-scale TypeScript applications with InversifyJS
Remo Jansen
 
Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react js
StephieJohn
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.js
Emanuele DelBono
 
Reproducible component tests using docker
Reproducible component tests using dockerReproducible component tests using docker
Reproducible component tests using docker
Pavel Rabetski
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥
Remo Jansen
 
React hooks Episode #1: An introduction.
React hooks Episode #1: An introduction.React hooks Episode #1: An introduction.
React hooks Episode #1: An introduction.
ManojSatishKumar
 
React and Flux life cycle with JSX, React Router and Jest Unit Testing
React and  Flux life cycle with JSX, React Router and Jest Unit TestingReact and  Flux life cycle with JSX, React Router and Jest Unit Testing
React and Flux life cycle with JSX, React Router and Jest Unit Testing
Eswara Kumar Palakollu
 
Workshop 22: React-Redux Middleware
Workshop 22: React-Redux MiddlewareWorkshop 22: React-Redux Middleware
Workshop 22: React-Redux Middleware
Visual Engineering
 
React js t6 -lifecycle
React js   t6 -lifecycleReact js   t6 -lifecycle
React js t6 -lifecycle
Jainul Musani
 

Viewers also liked (13)

Plots in neemrana behror,nh8
Plots in neemrana behror,nh8 Plots in neemrana behror,nh8
Plots in neemrana behror,nh8
Baburaj Patel
 
Aviso de convocatoria
Aviso de convocatoriaAviso de convocatoria
Aviso de convocatoria
FUNDACION INTERNACIONAL DE PEDAGOGIA CONCEPTUAL ALBERTO MERANI UPE
 
Resume_Misty Goodmote2
Resume_Misty Goodmote2Resume_Misty Goodmote2
Resume_Misty Goodmote2
misty goodmote
 
Linked_Page
Linked_PageLinked_Page
Linked_Page
IEEE Int. Conference MECHATRONICS
 
Rita's Resume 2
Rita's Resume 2Rita's Resume 2
Rita's Resume 2
Rita Robles
 
Industry Insights with Lisa Heppel
Industry Insights with Lisa HeppelIndustry Insights with Lisa Heppel
Industry Insights with Lisa Heppel
Charlotte Doherty 🌏✈️
 
Best Practices for Accelerating Continuous Testing
Best Practices for Accelerating Continuous TestingBest Practices for Accelerating Continuous Testing
Best Practices for Accelerating Continuous Testing
Sailaja Tennati
 
Lecture 11222016
Lecture 11222016Lecture 11222016
Lecture 11222016
Vricks Cabrito
 
book_connected-aviation
book_connected-aviationbook_connected-aviation
book_connected-aviation
Steven Loving
 
Debbie resume
Debbie resumeDebbie resume
Debbie resume
Debbie McKaughan
 
Advancement in civil engineering
Advancement in civil engineeringAdvancement in civil engineering
Advancement in civil engineering
pratik vanam
 
Множење и дељење
Множење и дељењеМножење и дељење
Множење и дељење
Ивана Ћуковић
 
Množenje i deljenje višecifrenih brojeva
Množenje i deljenje višecifrenih brojevaMnoženje i deljenje višecifrenih brojeva
Množenje i deljenje višecifrenih brojeva
Ивана Ћуковић
 
Ad

Similar to ReactJS (1) (20)

Dyanaimcs of business and economics unit 2
Dyanaimcs of business and economics unit 2Dyanaimcs of business and economics unit 2
Dyanaimcs of business and economics unit 2
jpm071712
 
react-slides.pptx
react-slides.pptxreact-slides.pptx
react-slides.pptx
DayNightGaMiNg
 
react-slidlkjfl;kj;dlkjopidfjhopijgpoerjpofjiwoepifjopweifjepoies.pptx
react-slidlkjfl;kj;dlkjopidfjhopijgpoerjpofjiwoepifjopweifjepoies.pptxreact-slidlkjfl;kj;dlkjopidfjhopijgpoerjpofjiwoepifjopweifjepoies.pptx
react-slidlkjfl;kj;dlkjopidfjhopijgpoerjpofjiwoepifjopweifjepoies.pptx
PrathamSharma77833
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react library
janet736113
 
react-slides.pdf
react-slides.pdfreact-slides.pdf
react-slides.pdf
DayNightGaMiNg
 
TRAINING pptt efwoiefo weoifjoiewjfoifjow.pptx
TRAINING pptt efwoiefo weoifjoiewjfoifjow.pptxTRAINING pptt efwoiefo weoifjoiewjfoifjow.pptx
TRAINING pptt efwoiefo weoifjoiewjfoifjow.pptx
PrathamSharma77833
 
ReactJS
ReactJSReactJS
ReactJS
Ram Murat Sharma
 
Fundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdfFundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdf
StephieJohn
 
REACTJS.pdf
REACTJS.pdfREACTJS.pdf
REACTJS.pdf
ArthyR3
 
A React Journey
A React JourneyA React Journey
A React Journey
LinkMe Srl
 
React
ReactReact
React
manii kanta
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
Nitin Tyagi
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
Tariqul islam
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
Jeff Durta
 
React js
React jsReact js
React js
Rajesh Kolla
 
Corso su ReactJS
Corso su ReactJSCorso su ReactJS
Corso su ReactJS
LinkMe Srl
 
Workshop 19: ReactJS Introduction
Workshop 19: ReactJS IntroductionWorkshop 19: ReactJS Introduction
Workshop 19: ReactJS Introduction
Visual Engineering
 
Materi Modern React Redux Power Point.pdf
Materi Modern React Redux Power Point.pdfMateri Modern React Redux Power Point.pdf
Materi Modern React Redux Power Point.pdf
exiabreak
 
REACT pdf.docx
REACT pdf.docxREACT pdf.docx
REACT pdf.docx
PSK Technolgies Pvt. Ltd. IT Company Nagpur
 
Interview Questions On React JS.pptx
Interview Questions On React JS.pptxInterview Questions On React JS.pptx
Interview Questions On React JS.pptx
DucatNoida1
 
Dyanaimcs of business and economics unit 2
Dyanaimcs of business and economics unit 2Dyanaimcs of business and economics unit 2
Dyanaimcs of business and economics unit 2
jpm071712
 
react-slidlkjfl;kj;dlkjopidfjhopijgpoerjpofjiwoepifjopweifjepoies.pptx
react-slidlkjfl;kj;dlkjopidfjhopijgpoerjpofjiwoepifjopweifjepoies.pptxreact-slidlkjfl;kj;dlkjopidfjhopijgpoerjpofjiwoepifjopweifjepoies.pptx
react-slidlkjfl;kj;dlkjopidfjhopijgpoerjpofjiwoepifjopweifjepoies.pptx
PrathamSharma77833
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react library
janet736113
 
TRAINING pptt efwoiefo weoifjoiewjfoifjow.pptx
TRAINING pptt efwoiefo weoifjoiewjfoifjow.pptxTRAINING pptt efwoiefo weoifjoiewjfoifjow.pptx
TRAINING pptt efwoiefo weoifjoiewjfoifjow.pptx
PrathamSharma77833
 
Fundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdfFundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdf
StephieJohn
 
REACTJS.pdf
REACTJS.pdfREACTJS.pdf
REACTJS.pdf
ArthyR3
 
A React Journey
A React JourneyA React Journey
A React Journey
LinkMe Srl
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
Nitin Tyagi
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
Tariqul islam
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
Jeff Durta
 
Corso su ReactJS
Corso su ReactJSCorso su ReactJS
Corso su ReactJS
LinkMe Srl
 
Workshop 19: ReactJS Introduction
Workshop 19: ReactJS IntroductionWorkshop 19: ReactJS Introduction
Workshop 19: ReactJS Introduction
Visual Engineering
 
Materi Modern React Redux Power Point.pdf
Materi Modern React Redux Power Point.pdfMateri Modern React Redux Power Point.pdf
Materi Modern React Redux Power Point.pdf
exiabreak
 
Interview Questions On React JS.pptx
Interview Questions On React JS.pptxInterview Questions On React JS.pptx
Interview Questions On React JS.pptx
DucatNoida1
 
Ad

ReactJS (1)

  • 1. ReactJS A Web Library for web development By George Tony
  • 2. History Created By Jordan Walke, Facebook Influenced by XHP, an HTML component framework for PHP Open Source on 2013 Released React Native for IOS and android development in React on 2015 React and React native are top two stared open sourced project of facebook. React is 6th most starred project( Star : 52k, Fork : 9k )
  • 3. Introduction Written in JSX Supports ES6(ECMAScript 6). Classes ,arrow function … support comes to React with ES6. Can create reusable Components <HelloWorld/> <div> Hello World </div> Unidirectional. Virtual DOM to detect Changes.
  • 4. JSX and ES6 JSX is a preprocessor step that adds XML syntax to JavaScript. ES6 new standard for Javascript which give support for much needed classes etc. Compilers are used to convert JSX files to javascript for web browser.
  • 5. Reusable Component. Componet in React are like Html tag Eg <input> Link fo support html tag. All the html tag are supported by the react. Give ability to create New Component with existing ones Events Handlers. Html event like click, focus, hover are handled by the event handler in React Eg <input value={this.state.value} onChange={ e => this.setState( { value : e.target.value })}/>
  • 6. Console of react Component console.log(this) { “props” : { ... }, // all the attribute of react component “state” : {... }, // all state variable in hash “refs” : {...}, // all reference to child components render(){...}, // render function component*(){..} // Life cycle function ….. // other user defined function }
  • 7. React special attributes Key Used to map array of child node className Used to give css classname Style Inline style to react element Hash of key-value pairs Ref <ul className=”list” ref=”listItem”> <li key=1 style={style1}> 1 </li> <li key=2 style={style2}> 2 </li> </ul>
  • 8. React Architecture React Component Virtual Dom Browser Dom Inter Communicating Components Virtual Dom Detecting DOM changes to apply to Browser DOM DOM changes to Virtual Dom Browser Rerenders
  • 9. Creating Components Main Comparts of React Component: State, props,render function.
  • 10. State : a Hash key where all state information about a React component are stored. Eg { “Props” : { ….}, Render(){}, “State” : { “Name” : “tony”, “Team”: “foss” } }
  • 11. Props: List all tag and attributes passed to web component. Eg. <HelloWorld value=”Hello World”/> { “Props” : { “Value” : “Hello World” } “State” :{}, Render(){} }
  • 12. Render function: Function return what to output to web browser. Eg render(){ Return ( <div> <p> Hello World </p> </div> ) } Render function is called when state variable is changed by using this.setState method. Rendering Component for small change with state that has no effect UI is expensive to Avoid this we use function shouldComponentUpdate.More about this will cover in Component Life Cycle.
  • 13. React Virtual Dom React is Unidirectional. If anyone want to modify html element in the browser . It has to be through React Only. If any modification from outside react will be overwritten by React on Next Dom Modification. React checks if there any for diff b/w Browser Dom in its Memory and Virtual DOM. Any Changes is applied to browser.
  • 15. Constructor Constructor to React Class. Argument for constructor is props you should call super(props) before any other statement. Otherwise, this.props will be undefined in the constructor, which can lead to bugs. The constructor is the right place to initialize state. If you don't initialize state and you don't bind methods, you don't need to implement a constructor for your React component. constructor(props) { super(props); this.state = { color: props.initialColor
  • 17. ComponentWillMount This function is invoked before initial render. If setState is used in this function . Render function execute with new state.
  • 18. ComponentDidMount Called after initial render. At this state all the reference to component can be set properly. Integration to Other JS Library is done here with timeout functions.
  • 19. ComponentWillReceiveProps This function is called whenever Props to component is changed. setState will create additional render in this function. Argument newProps
  • 20. ShouldComponentUpdate Decision to re render or not ? Returns Boolean True : Component re render. False: component skip render. Effective for state change which does not involve UI changes Argument to this newState,newProps
  • 21. ComponentWillUpdate Preparing Component For updating. Argument newState, newProps
  • 22. componentDidUpdate Called After re render. Similar to componentDidMount. Argument oldState, oldProps
  • 23. ComponentWillUnmount Called before component gets removed from Dom Cleaning reference and changes done by external Library in componentDidUpdate and componentDidMount
  • 24. Class Property defaultProps defaultProps = { name : “g”} propTypes propTypes = { name : React.PropTypes.string }
  翻译: