(Go: >> BACK << -|- >> HOME <<)

SlideShare a Scribd company logo
By Sahana Banerjee
REACT JS
WHAT IS REACT.JS?
A JavaScript library for building user interfaces. Reactjs is
created by the Facebook for the V of MVC by reusable and
interactive UI components.
WHO IS USING REACTJS?
 Facebook – Partial
 Instagram
 Netflix
 Paypal…etc
WHY REACT.JS?
 V(view) of MVC - Solution of View in MVC
 Virtual DOM - Reactjs use the concept of virtual DOM which helps in the performance
 Unidirectional Data Flow - Compare to the 2 way data binding. Reactjs use the concept of
Unidirectional data flow which improve the over all performance.
 UI Components - Reusable and interactive components
 SEO Friendly - Components are client side as well as server side render hence they are SEO
friendly and no 3rd party plugin required
 Coding is simpler because of JSX
 Reactjs own debugger
 React Native is going to be next big thing
 Big minds are backing Reactjs
CORE CONCEPT OF REACTJS
Unidirectional
Data Flow
ComponentsJSX
Virtual DOM
JSX
JSX - javascript XML syntax transform.
It helps in making our writing code easier and
faster. JSX lets us writeHTML (not 100%) with XML
based object representation.
Line 8-19 : Telling browser the code between the script block is JSX and not normal
JavaScript.
Line no 12 : This is how we write the HTML in JSX
COMPONENTS
 In Reactjs the whole application is break into the
components.
 Components are interactive, reusable and
stateful too.
If you don’t want to use JSX, you can still work in react however the code would be like
the above as compare to the last slide without JSX
Line 9 : We are creating our component with name MyApp
Line 18 : We are calling/rendering our component in the content div on the HTML
page
LETS START
For a simple React program:
 Download react
 Download JSX
 Install React debugger tool (Chrome)
For building React Apps :
 Gulp
 Browserify
 Node js, etc …
SIMPLE REACT PROGRAM
COMPONENTS
 Everything in reactjs is components.
 The core building blocks of React application is
components only.
 Components interact with each other and maintain the
state too.
 In Reactjs whole application is need to be break into
the component only.
ReactJs
PROPS
 In Reactjs props are like the HTML Properties. They are
used to pass the data between the components or via
the states.
 In Reactjs the props can be accessed by
this.props.propsname
 Props can be define by name=“value”. To access this we
have to call this.props.name
React.render(<MyComponent name=“Neha” />) : name is the one of the props of
the component MyComponent . To access the value of the props in the react we
use {this.props.name}.
STATES
• Every component has a State object. Can be set by using
setState.
• setState triggers UI updates and to get the initial state
before the setState :
• getInitialState
• getDefaultProps
Reactjs maintained the state – getIntialState, setState, getDefaultProps.
In the above example we are getting the count variable to 5 and accessing it by
{this.state.count}
COMPONENT LIFECYCLE
 componentWillMount – Client and server side
componenet Will Occur only once (before)
 componentDidMount – Only once (after)
 shouldComponentUpdate – Return value
determines weather component should update
 componentWillUnmount – Before unmounting
component
ReactJs
EVENTS
 Reactjs has the events that are attached
with the components as the props of the
components and can trigger methods.
We have created a custom method clickCount and onClick of the button we are
calling it onClick = {this.clickCount}
UNIDRIECTIONAL DATA FLOW
 In reactjs, application data flows unidirectional via the
state and props not like angular js where we have 2-way
data binding. Which means in multiple component
hierarchy , a common parent component should manage
the state and pass it down the chain by props.
 setState - state should be updated by setState to ensure
UI will refresh/update
 this.props – to pass the value to the child components
UNIDIRECTIONAL DATA FLOW
- In Reactjs application the data flow from the parent to the children
component by the state and the props.
- Only one parent is responsible to update the states and passing the
value to the children components via props.
- setState is used to update/refresh the UI when the state change and
the value can be pass to the children component by the this.props
ReactJs
VIRTUAL VIRTUAL DOM
 Reactjs uses the concept of the virtual DOM.
 It selectively render the subtree of DOM elements into the
rendering of the DOM on state change
 Use different algorithm with the browser DOM tree to identify
the changes
 Instead of creating new object, Reactjs just identify what change
is took place and once identify update that state.
 This way it is creating a virtual DOM and improving the
performance too
 Can be render on server and sync on Local
Angular Backbone React
Type MV* MVC V
Technology HTML/CSS/JS/Ang
ular
HTML/CSS/JS/back
bone
JSX
Core MVC MVC Components
View HTML HTML Virtual DOM
Data Flowing 2 way binding - Unidirectional
Creator Google - FB* & Instagram
Architchure - - React Native &
Flux
SEO Support Phantom js - SEO friendly
THANK YOU!
28
Thankyou 

More Related Content

What's hot

React js programming concept
React js programming conceptReact js programming concept
React js programming concept
Tariqul islam
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorial
Mohammed Fazuluddin
 
Reactjs
ReactjsReactjs
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
 
Intro to React
Intro to ReactIntro to React
Intro to React
Justin Reock
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_js
MicroPyramid .
 
Reactjs
Reactjs Reactjs
Reactjs
Neha Sharma
 
React workshop
React workshopReact workshop
React workshop
Imran Sayed
 
ReactJS
ReactJSReactJS
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
valuebound
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.js
Emanuele DelBono
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
Bethmi Gunasekara
 
React and redux
React and reduxReact and redux
React and redux
Mystic Coders, LLC
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
Rob Quick
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
Nikolaus Graf
 
react redux.pdf
react redux.pdfreact redux.pdf
react redux.pdf
Knoldus Inc.
 
React js
React jsReact js
React js
Alireza Akbari
 
Intro to React
Intro to ReactIntro to React
Intro to React
Eric Westfall
 
An Introduction to Redux
An Introduction to ReduxAn Introduction to Redux
An Introduction to Redux
NexThoughts Technologies
 
React JS
React JSReact JS

What's hot (20)

React js programming concept
React js programming conceptReact js programming concept
React js programming concept
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorial
 
Reactjs
ReactjsReactjs
Reactjs
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_js
 
Reactjs
Reactjs Reactjs
Reactjs
 
React workshop
React workshopReact workshop
React workshop
 
ReactJS
ReactJSReactJS
ReactJS
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.js
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
 
React and redux
React and reduxReact and redux
React and redux
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
 
react redux.pdf
react redux.pdfreact redux.pdf
react redux.pdf
 
React js
React jsReact js
React js
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
An Introduction to Redux
An Introduction to ReduxAn Introduction to Redux
An Introduction to Redux
 
React JS
React JSReact JS
React JS
 

Similar to ReactJs

Getting started with react &amp; redux
Getting started with react &amp; reduxGetting started with react &amp; redux
Getting started with react &amp; redux
Girish Talekar
 
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
 
SharePoint Framework y React
SharePoint Framework y ReactSharePoint Framework y React
SharePoint Framework y React
SUGES (SharePoint Users Group España)
 
Copy of React_JS_Notes.pdf
Copy of React_JS_Notes.pdfCopy of React_JS_Notes.pdf
Copy of React_JS_Notes.pdf
suryanarayana272799
 
React JS Interview Question & Answer
React JS Interview Question & AnswerReact JS Interview Question & Answer
React JS Interview Question & Answer
Mildain Solutions
 
Intro react js
Intro react jsIntro react js
Intro react js
Vijayakanth MP
 
REACTJS.pdf
REACTJS.pdfREACTJS.pdf
REACTJS.pdf
ArthyR3
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
Karmanjay Verma
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥
Remo Jansen
 
Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react js
StephieJohn
 
Tech Talk on ReactJS
Tech Talk on ReactJSTech Talk on ReactJS
Tech Talk on ReactJS
Atlogys Technical Consulting
 
React
ReactReact
React
ReactReact
Everything to Know About React Re-Rendering: A Comprehensive Guide
Everything to Know About React Re-Rendering: A Comprehensive GuideEverything to Know About React Re-Rendering: A Comprehensive Guide
Everything to Know About React Re-Rendering: A Comprehensive Guide
BOSC Tech Labs
 
Introduction to React JS.pptx
Introduction to React JS.pptxIntroduction to React JS.pptx
Introduction to React JS.pptx
SHAIKIRFAN715544
 
Introduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptxIntroduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptx
SHAIKIRFAN715544
 
Build web apps with react js
Build web apps with react jsBuild web apps with react js
Build web apps with react js
dhanushkacnd
 
React Interview Question & Answers PDF By ScholarHat
React Interview Question & Answers PDF By ScholarHatReact Interview Question & Answers PDF By ScholarHat
React Interview Question & Answers PDF By ScholarHat
Scholarhat
 
Presentation on "An Introduction to ReactJS"
Presentation on "An Introduction to ReactJS"Presentation on "An Introduction to ReactJS"
Presentation on "An Introduction to ReactJS"
Flipkart
 
Learn Stateful and Stateless components in ReactJS
Learn Stateful and Stateless components in ReactJS Learn Stateful and Stateless components in ReactJS
Learn Stateful and Stateless components in ReactJS
RajasreePothula3
 

Similar to ReactJs (20)

Getting started with react &amp; redux
Getting started with react &amp; reduxGetting started with react &amp; redux
Getting started with react &amp; redux
 
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
 
SharePoint Framework y React
SharePoint Framework y ReactSharePoint Framework y React
SharePoint Framework y React
 
Copy of React_JS_Notes.pdf
Copy of React_JS_Notes.pdfCopy of React_JS_Notes.pdf
Copy of React_JS_Notes.pdf
 
React JS Interview Question & Answer
React JS Interview Question & AnswerReact JS Interview Question & Answer
React JS Interview Question & Answer
 
Intro react js
Intro react jsIntro react js
Intro react js
 
REACTJS.pdf
REACTJS.pdfREACTJS.pdf
REACTJS.pdf
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥
 
Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react js
 
Tech Talk on ReactJS
Tech Talk on ReactJSTech Talk on ReactJS
Tech Talk on ReactJS
 
React
ReactReact
React
 
React
ReactReact
React
 
Everything to Know About React Re-Rendering: A Comprehensive Guide
Everything to Know About React Re-Rendering: A Comprehensive GuideEverything to Know About React Re-Rendering: A Comprehensive Guide
Everything to Know About React Re-Rendering: A Comprehensive Guide
 
Introduction to React JS.pptx
Introduction to React JS.pptxIntroduction to React JS.pptx
Introduction to React JS.pptx
 
Introduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptxIntroduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptx
 
Build web apps with react js
Build web apps with react jsBuild web apps with react js
Build web apps with react js
 
React Interview Question & Answers PDF By ScholarHat
React Interview Question & Answers PDF By ScholarHatReact Interview Question & Answers PDF By ScholarHat
React Interview Question & Answers PDF By ScholarHat
 
Presentation on "An Introduction to ReactJS"
Presentation on "An Introduction to ReactJS"Presentation on "An Introduction to ReactJS"
Presentation on "An Introduction to ReactJS"
 
Learn Stateful and Stateless components in ReactJS
Learn Stateful and Stateless components in ReactJS Learn Stateful and Stateless components in ReactJS
Learn Stateful and Stateless components in ReactJS
 

Recently uploaded

Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Chris Swan
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
ArgaBisma
 
一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理
一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理
一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理
uuuot
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
ishalveerrandhawa1
 
STKI Israeli Market Study 2024 final v1
STKI Israeli Market Study 2024 final  v1STKI Israeli Market Study 2024 final  v1
STKI Israeli Market Study 2024 final v1
Dr. Jimmy Schwarzkopf
 
Research Directions for Cross Reality Interfaces
Research Directions for Cross Reality InterfacesResearch Directions for Cross Reality Interfaces
Research Directions for Cross Reality Interfaces
Mark Billinghurst
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
shanthidl1
 
What Not to Document and Why_ (North Bay Python 2024)
What Not to Document and Why_ (North Bay Python 2024)What Not to Document and Why_ (North Bay Python 2024)
What Not to Document and Why_ (North Bay Python 2024)
Margaret Fero
 
Quantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLMQuantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLM
Vijayananda Mohire
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
BookNet Canada
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
BookNet Canada
 
Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024
The Digital Insurer
 
Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1
FellyciaHikmahwarani
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
SynapseIndia
 
@Call @Girls Pune 0000000000 Riya Khan Beautiful Girl any Time
@Call @Girls Pune 0000000000 Riya Khan Beautiful Girl any Time@Call @Girls Pune 0000000000 Riya Khan Beautiful Girl any Time
@Call @Girls Pune 0000000000 Riya Khan Beautiful Girl any Time
amitchopra0215
 
Interaction Latency: Square's User-Centric Mobile Performance Metric
Interaction Latency: Square's User-Centric Mobile Performance MetricInteraction Latency: Square's User-Centric Mobile Performance Metric
Interaction Latency: Square's User-Centric Mobile Performance Metric
ScyllaDB
 
K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024
The Digital Insurer
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
jackson110191
 
AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)
apoorva2579
 

Recently uploaded (20)

Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
 
一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理
一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理
一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
 
STKI Israeli Market Study 2024 final v1
STKI Israeli Market Study 2024 final  v1STKI Israeli Market Study 2024 final  v1
STKI Israeli Market Study 2024 final v1
 
Research Directions for Cross Reality Interfaces
Research Directions for Cross Reality InterfacesResearch Directions for Cross Reality Interfaces
Research Directions for Cross Reality Interfaces
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
 
What Not to Document and Why_ (North Bay Python 2024)
What Not to Document and Why_ (North Bay Python 2024)What Not to Document and Why_ (North Bay Python 2024)
What Not to Document and Why_ (North Bay Python 2024)
 
Quantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLMQuantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLM
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
 
Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024
 
Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
 
@Call @Girls Pune 0000000000 Riya Khan Beautiful Girl any Time
@Call @Girls Pune 0000000000 Riya Khan Beautiful Girl any Time@Call @Girls Pune 0000000000 Riya Khan Beautiful Girl any Time
@Call @Girls Pune 0000000000 Riya Khan Beautiful Girl any Time
 
Interaction Latency: Square's User-Centric Mobile Performance Metric
Interaction Latency: Square's User-Centric Mobile Performance MetricInteraction Latency: Square's User-Centric Mobile Performance Metric
Interaction Latency: Square's User-Centric Mobile Performance Metric
 
K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
 
AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)
 

ReactJs

  • 2. WHAT IS REACT.JS? A JavaScript library for building user interfaces. Reactjs is created by the Facebook for the V of MVC by reusable and interactive UI components.
  • 3. WHO IS USING REACTJS?  Facebook – Partial  Instagram  Netflix  Paypal…etc
  • 4. WHY REACT.JS?  V(view) of MVC - Solution of View in MVC  Virtual DOM - Reactjs use the concept of virtual DOM which helps in the performance  Unidirectional Data Flow - Compare to the 2 way data binding. Reactjs use the concept of Unidirectional data flow which improve the over all performance.  UI Components - Reusable and interactive components  SEO Friendly - Components are client side as well as server side render hence they are SEO friendly and no 3rd party plugin required  Coding is simpler because of JSX  Reactjs own debugger  React Native is going to be next big thing  Big minds are backing Reactjs
  • 5. CORE CONCEPT OF REACTJS Unidirectional Data Flow ComponentsJSX Virtual DOM
  • 6. JSX JSX - javascript XML syntax transform. It helps in making our writing code easier and faster. JSX lets us writeHTML (not 100%) with XML based object representation.
  • 7. Line 8-19 : Telling browser the code between the script block is JSX and not normal JavaScript. Line no 12 : This is how we write the HTML in JSX
  • 8. COMPONENTS  In Reactjs the whole application is break into the components.  Components are interactive, reusable and stateful too.
  • 9. If you don’t want to use JSX, you can still work in react however the code would be like the above as compare to the last slide without JSX
  • 10. Line 9 : We are creating our component with name MyApp Line 18 : We are calling/rendering our component in the content div on the HTML page
  • 11. LETS START For a simple React program:  Download react  Download JSX  Install React debugger tool (Chrome) For building React Apps :  Gulp  Browserify  Node js, etc …
  • 13. COMPONENTS  Everything in reactjs is components.  The core building blocks of React application is components only.  Components interact with each other and maintain the state too.  In Reactjs whole application is need to be break into the component only.
  • 15. PROPS  In Reactjs props are like the HTML Properties. They are used to pass the data between the components or via the states.  In Reactjs the props can be accessed by this.props.propsname  Props can be define by name=“value”. To access this we have to call this.props.name
  • 16. React.render(<MyComponent name=“Neha” />) : name is the one of the props of the component MyComponent . To access the value of the props in the react we use {this.props.name}.
  • 17. STATES • Every component has a State object. Can be set by using setState. • setState triggers UI updates and to get the initial state before the setState : • getInitialState • getDefaultProps
  • 18. Reactjs maintained the state – getIntialState, setState, getDefaultProps. In the above example we are getting the count variable to 5 and accessing it by {this.state.count}
  • 19. COMPONENT LIFECYCLE  componentWillMount – Client and server side componenet Will Occur only once (before)  componentDidMount – Only once (after)  shouldComponentUpdate – Return value determines weather component should update  componentWillUnmount – Before unmounting component
  • 21. EVENTS  Reactjs has the events that are attached with the components as the props of the components and can trigger methods.
  • 22. We have created a custom method clickCount and onClick of the button we are calling it onClick = {this.clickCount}
  • 23. UNIDRIECTIONAL DATA FLOW  In reactjs, application data flows unidirectional via the state and props not like angular js where we have 2-way data binding. Which means in multiple component hierarchy , a common parent component should manage the state and pass it down the chain by props.  setState - state should be updated by setState to ensure UI will refresh/update  this.props – to pass the value to the child components
  • 24. UNIDIRECTIONAL DATA FLOW - In Reactjs application the data flow from the parent to the children component by the state and the props. - Only one parent is responsible to update the states and passing the value to the children components via props. - setState is used to update/refresh the UI when the state change and the value can be pass to the children component by the this.props
  • 26. VIRTUAL VIRTUAL DOM  Reactjs uses the concept of the virtual DOM.  It selectively render the subtree of DOM elements into the rendering of the DOM on state change  Use different algorithm with the browser DOM tree to identify the changes  Instead of creating new object, Reactjs just identify what change is took place and once identify update that state.  This way it is creating a virtual DOM and improving the performance too  Can be render on server and sync on Local
  • 27. Angular Backbone React Type MV* MVC V Technology HTML/CSS/JS/Ang ular HTML/CSS/JS/back bone JSX Core MVC MVC Components View HTML HTML Virtual DOM Data Flowing 2 way binding - Unidirectional Creator Google - FB* & Instagram Architchure - - React Native & Flux SEO Support Phantom js - SEO friendly