SlideShare a Scribd company logo
Introduction to
ReactJS
AESHAN WIJETUNGE
Why use React.js?
 Simple
 Declarative
 Build Composable Components
Credits: https://facebook.github.io/react/docs/why-react.html
http://kognitio.com/why-is-spark-on-the-rise-does-it-meet-business-needs/lego/
Popularity
 Popularity of React has been pretty high since 2015
 Downloads : ~ 933,860 in the last month
Credits: https://twitter.com/mjasay/status/618185536381935616
Current state of web
development
 HTML Views implemented in a dynamic templating language e.g:
dustJS, JSP…
 Validation & other functionality in MVC UI frameworks like
BackboneJS
 This makes for very fragmented development…
BackBoneJS
View 1
Templates
BackBoneJS
View 2
/public/js /public/templates
View Templating: many
options
JSX: markup in Javascript
Component 1
Component 2
Componentization
 Ideal overview of a React web app
JSX
logic
state
Logic
JSX
include
A Basic Example : Objectives
 A simple component that takes a user input, validates
it and shows an error message upon an error.
 Render a React component
 Make it dynamic : so its reusable
 Make it interactive : add functionality
The end goal
Create the view
 JSX is the most common means of writing Views for
React.
Dynamic Views
 Seldom can components be static and hardcoded.
We’ll need to pass parameters into ours to make it
more re-useable. These are called props.
Under the hood: Virtual DOM
Credit http://madhukaudantha.blogspot.sg/2015/04/reactjs-and-virtual-
dom.html
Event handling
Event handler
Attach handler
Traversing the DOM Tree
 However we also need to access the DOM of the
elements within component
 To do this we need to use React refs
Credits: http://adam.merrifield.ca/presentations/dom_demystified/
Refs – Access the DOM
 Refs are a React feature for accessing and thus
manipulating the HTML DOM.
 Ref scope is limited to the React component
 They essentially reference DOM elements
<input ref=“first_name” name=“first_name” value=“5”/>
this.refs.first_name
Value = 5
Adding the DOM refs
Access the DOM
element via ref
Ref the DOM
element
State-fulness
Credits: http://odetocode.com/articles/460.aspx
Adding state-management
 Let’s add some new function methods
Initial state
Change state
Get the value
Live Demo!

More Related Content

What's hot

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
Introduction to ReactIntroduction to React
Introduction to ReactRob Quick
 
React js programming concept
React js programming conceptReact js programming concept
React js programming conceptTariqul islam
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.jsEmanuele DelBono
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorialMohammed Fazuluddin
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJSKnoldus Inc.
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation洪 鹏发
 
The Benefits of Using React JS for Web Development!
The Benefits of Using React JS for Web Development!The Benefits of Using React JS for Web Development!
The Benefits of Using React JS for Web Development!Baharika Sopori
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_jsMicroPyramid .
 
learn what React JS is & why we should use React JS .
learn what React JS is & why we should use React JS .learn what React JS is & why we should use React JS .
learn what React JS is & why we should use React JS .paradisetechsoftsolutions
 
What is component in reactjs
What is component in reactjsWhat is component in reactjs
What is component in reactjsmanojbkalla
 
Introduction to react
Introduction to reactIntroduction to react
Introduction to reactkiranabburi
 

What's hot (20)

Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners
 
Its time to React.js
Its time to React.jsIts time to React.js
Its time to React.js
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.js
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorial
 
React JS - Introduction
React JS - IntroductionReact JS - Introduction
React JS - Introduction
 
React js for beginners
React js for beginnersReact js for beginners
React js for beginners
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
React workshop
React workshopReact workshop
React workshop
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
 
React js basics
React js basicsReact js basics
React js basics
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
The Benefits of Using React JS for Web Development!
The Benefits of Using React JS for Web Development!The Benefits of Using React JS for Web Development!
The Benefits of Using React JS for Web Development!
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_js
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
learn what React JS is & why we should use React JS .
learn what React JS is & why we should use React JS .learn what React JS is & why we should use React JS .
learn what React JS is & why we should use React JS .
 
What is component in reactjs
What is component in reactjsWhat is component in reactjs
What is component in reactjs
 
Introduction to react
Introduction to reactIntroduction to react
Introduction to react
 

Viewers also liked

WFD POSTER LANDSCAPE
WFD POSTER LANDSCAPEWFD POSTER LANDSCAPE
WFD POSTER LANDSCAPELotte Riddy
 
Socialmediaexaminer.Com Facebook 101 Business Guide | Social Media Exam...
Socialmediaexaminer.Com  Facebook 101  Business  Guide |  Social  Media  Exam...Socialmediaexaminer.Com  Facebook 101  Business  Guide |  Social  Media  Exam...
Socialmediaexaminer.Com Facebook 101 Business Guide | Social Media Exam...atetrainingexpo
 
The Missing Feature: Blockchain contracts
The Missing Feature: Blockchain contractsThe Missing Feature: Blockchain contracts
The Missing Feature: Blockchain contractsAeshan Wijetunge
 
A novel label-free cocaine assay based on aptamer-wrapped single-walled carbo...
A novel label-free cocaine assay based on aptamer-wrapped single-walled carbo...A novel label-free cocaine assay based on aptamer-wrapped single-walled carbo...
A novel label-free cocaine assay based on aptamer-wrapped single-walled carbo...Nanomedicine Journal (NMJ)
 
Media conversation! assignment (1)
Media conversation! assignment (1)Media conversation! assignment (1)
Media conversation! assignment (1)Mamadi Jaiteh
 
Company law –a new beginning
Company law –a new beginningCompany law –a new beginning
Company law –a new beginningNeha Godara
 
Helpful Work for Mathematics
Helpful Work for MathematicsHelpful Work for Mathematics
Helpful Work for Mathematicslaluls212
 
An Intense Overview of the React Ecosystem
An Intense Overview of the React EcosystemAn Intense Overview of the React Ecosystem
An Intense Overview of the React EcosystemRami Sayar
 
EXTENT-2015: Efficient Risk Control - Challenges & Techniques
EXTENT-2015: Efficient Risk Control - Challenges & TechniquesEXTENT-2015: Efficient Risk Control - Challenges & Techniques
EXTENT-2015: Efficient Risk Control - Challenges & TechniquesIosif Itkin
 

Viewers also liked (11)

WFD POSTER LANDSCAPE
WFD POSTER LANDSCAPEWFD POSTER LANDSCAPE
WFD POSTER LANDSCAPE
 
Socialmediaexaminer.Com Facebook 101 Business Guide | Social Media Exam...
Socialmediaexaminer.Com  Facebook 101  Business  Guide |  Social  Media  Exam...Socialmediaexaminer.Com  Facebook 101  Business  Guide |  Social  Media  Exam...
Socialmediaexaminer.Com Facebook 101 Business Guide | Social Media Exam...
 
British Gas Simply Thank You Jan 2015
British Gas Simply Thank You Jan 2015British Gas Simply Thank You Jan 2015
British Gas Simply Thank You Jan 2015
 
The Missing Feature: Blockchain contracts
The Missing Feature: Blockchain contractsThe Missing Feature: Blockchain contracts
The Missing Feature: Blockchain contracts
 
A novel label-free cocaine assay based on aptamer-wrapped single-walled carbo...
A novel label-free cocaine assay based on aptamer-wrapped single-walled carbo...A novel label-free cocaine assay based on aptamer-wrapped single-walled carbo...
A novel label-free cocaine assay based on aptamer-wrapped single-walled carbo...
 
2768 la nueva_regulación_2004-2005[1]
2768 la nueva_regulación_2004-2005[1]2768 la nueva_regulación_2004-2005[1]
2768 la nueva_regulación_2004-2005[1]
 
Media conversation! assignment (1)
Media conversation! assignment (1)Media conversation! assignment (1)
Media conversation! assignment (1)
 
Company law –a new beginning
Company law –a new beginningCompany law –a new beginning
Company law –a new beginning
 
Helpful Work for Mathematics
Helpful Work for MathematicsHelpful Work for Mathematics
Helpful Work for Mathematics
 
An Intense Overview of the React Ecosystem
An Intense Overview of the React EcosystemAn Intense Overview of the React Ecosystem
An Intense Overview of the React Ecosystem
 
EXTENT-2015: Efficient Risk Control - Challenges & Techniques
EXTENT-2015: Efficient Risk Control - Challenges & TechniquesEXTENT-2015: Efficient Risk Control - Challenges & Techniques
EXTENT-2015: Efficient Risk Control - Challenges & Techniques
 

Similar to Introduction to react js

FRONTEND DEVELOPMENT WITH REACT.JS
FRONTEND DEVELOPMENT WITH REACT.JSFRONTEND DEVELOPMENT WITH REACT.JS
FRONTEND DEVELOPMENT WITH REACT.JSIRJET Journal
 
The Best Guide to Know What, Why, When to Use Is ReactJS
The Best Guide to Know What, Why, When to Use Is ReactJSThe Best Guide to Know What, Why, When to Use Is ReactJS
The Best Guide to Know What, Why, When to Use Is ReactJSWeblineIndia
 
React js vs react native a comparative analysis
React js vs react native a comparative analysisReact js vs react native a comparative analysis
React js vs react native a comparative analysisShelly Megan
 
Skill practical javascript diy projects
Skill practical javascript diy projectsSkill practical javascript diy projects
Skill practical javascript diy projectsSkillPracticalEdTech
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today Nitin Tyagi
 
Review on React JS
Review on React JSReview on React JS
Review on React JSijtsrd
 
Maximize Development Efficiency with ReactJS.pdf
Maximize Development Efficiency with ReactJS.pdfMaximize Development Efficiency with ReactJS.pdf
Maximize Development Efficiency with ReactJS.pdfBOSC Tech Labs
 
reactjs interview questions.pdf
reactjs interview questions.pdfreactjs interview questions.pdf
reactjs interview questions.pdfrohityadav23214
 
Front End Development for Back End Java Developers - NYJavaSIG 2019
Front End Development for Back End Java Developers - NYJavaSIG 2019Front End Development for Back End Java Developers - NYJavaSIG 2019
Front End Development for Back End Java Developers - NYJavaSIG 2019Matt Raible
 
React.js vs angular.js a comparison
React.js vs angular.js a comparisonReact.js vs angular.js a comparison
React.js vs angular.js a comparisonNarola Infotech
 
Overview of React.JS - Internship Presentation - Week 5
Overview of React.JS - Internship Presentation - Week 5Overview of React.JS - Internship Presentation - Week 5
Overview of React.JS - Internship Presentation - Week 5Devang Garach
 
Why should you use react js for web app development
Why should you use react js for web app developmentWhy should you use react js for web app development
Why should you use react js for web app developmentReactJS
 

Similar to Introduction to react js (20)

FRONTEND DEVELOPMENT WITH REACT.JS
FRONTEND DEVELOPMENT WITH REACT.JSFRONTEND DEVELOPMENT WITH REACT.JS
FRONTEND DEVELOPMENT WITH REACT.JS
 
The Best Guide to Know What, Why, When to Use Is ReactJS
The Best Guide to Know What, Why, When to Use Is ReactJSThe Best Guide to Know What, Why, When to Use Is ReactJS
The Best Guide to Know What, Why, When to Use Is ReactJS
 
React js vs react native a comparative analysis
React js vs react native a comparative analysisReact js vs react native a comparative analysis
React js vs react native a comparative analysis
 
Reactjs
ReactjsReactjs
Reactjs
 
learning react
learning reactlearning react
learning react
 
React JS part 1
React JS part 1React JS part 1
React JS part 1
 
Skill practical javascript diy projects
Skill practical javascript diy projectsSkill practical javascript diy projects
Skill practical javascript diy projects
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
 
From MVC to React
From MVC to ReactFrom MVC to React
From MVC to React
 
Review on React JS
Review on React JSReview on React JS
Review on React JS
 
Tech Talk on ReactJS
Tech Talk on ReactJSTech Talk on ReactJS
Tech Talk on ReactJS
 
MVC & backbone.js
MVC & backbone.jsMVC & backbone.js
MVC & backbone.js
 
Maximize Development Efficiency with ReactJS.pdf
Maximize Development Efficiency with ReactJS.pdfMaximize Development Efficiency with ReactJS.pdf
Maximize Development Efficiency with ReactJS.pdf
 
React intro
React introReact intro
React intro
 
reactjs interview questions.pdf
reactjs interview questions.pdfreactjs interview questions.pdf
reactjs interview questions.pdf
 
Front End Development for Back End Java Developers - NYJavaSIG 2019
Front End Development for Back End Java Developers - NYJavaSIG 2019Front End Development for Back End Java Developers - NYJavaSIG 2019
Front End Development for Back End Java Developers - NYJavaSIG 2019
 
React.js vs angular.js a comparison
React.js vs angular.js a comparisonReact.js vs angular.js a comparison
React.js vs angular.js a comparison
 
What is ReactJS?
What is ReactJS?What is ReactJS?
What is ReactJS?
 
Overview of React.JS - Internship Presentation - Week 5
Overview of React.JS - Internship Presentation - Week 5Overview of React.JS - Internship Presentation - Week 5
Overview of React.JS - Internship Presentation - Week 5
 
Why should you use react js for web app development
Why should you use react js for web app developmentWhy should you use react js for web app development
Why should you use react js for web app development
 

Recently uploaded

audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkkaudience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkklolsDocherty
 
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理aagad
 
ER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEHimani415946
 
Bug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's GuideBug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's GuideVarun Mithran
 
The AI Powered Organization-Intro to AI-LAN.pdf
The AI Powered Organization-Intro to AI-LAN.pdfThe AI Powered Organization-Intro to AI-LAN.pdf
The AI Powered Organization-Intro to AI-LAN.pdfSiskaFitrianingrum
 
Pvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdfPvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdfPvtaan
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesSanjeev Rampal
 
Article writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptxArticle writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptxabhinandnam9997
 
How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?Linksys Velop Login
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxlaozhuseo02
 
Case study on merger of Vodafone and Idea (VI).pptx
Case study on merger of Vodafone and Idea (VI).pptxCase study on merger of Vodafone and Idea (VI).pptx
Case study on merger of Vodafone and Idea (VI).pptxAnkitscribd
 
The Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case StudyThe Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case StudyDamar Juniarto
 

Recently uploaded (13)

audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkkaudience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
 
The Best AI Powered Software - Intellivid AI Studio
The Best AI Powered Software - Intellivid AI StudioThe Best AI Powered Software - Intellivid AI Studio
The Best AI Powered Software - Intellivid AI Studio
 
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
 
ER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAE
 
Bug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's GuideBug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's Guide
 
The AI Powered Organization-Intro to AI-LAN.pdf
The AI Powered Organization-Intro to AI-LAN.pdfThe AI Powered Organization-Intro to AI-LAN.pdf
The AI Powered Organization-Intro to AI-LAN.pdf
 
Pvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdfPvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdf
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
 
Article writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptxArticle writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptx
 
How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
 
Case study on merger of Vodafone and Idea (VI).pptx
Case study on merger of Vodafone and Idea (VI).pptxCase study on merger of Vodafone and Idea (VI).pptx
Case study on merger of Vodafone and Idea (VI).pptx
 
The Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case StudyThe Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case Study
 

Introduction to react js

Editor's Notes

  1. * Simple Simply express how your app should look at any given point in time, and React will automatically manage all UI updates when your underlying data changes. * Declarative When the data changes, React conceptually hits the "refresh" button, and knows to only update the changed parts.
  2. Use diagram example to highlight issues of code-reuse and app-maintence with app-functionality fragmented throughout the codebase.
  3. Basically these template engines compile into HTML which renders on the user’s browser. But it allows developers to re-use code and inject dynamic content into otherwise dull static web pages. Ask the audience what they think the dust-partial does (example of how cryptic each engine can be)
  4. Explain and run the audience thru the 2 components and how they’re combined into one view which is rendered into a div-element by the reactJS engine.
  5. Explain the example. The way React compares the DOMs, notes diff changes and re-renders only the delta part of the DOM. This partial update is much faster than a full DOM update.
  6. Before we can proceed to add validation logic into our component we’ll need to understand another React concept: State Almost all applications maintain some form of state (e.g: User clicker ‘Like’ on a social-media site which increments a counter)