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

PPTX
Introduction to React JS for beginners
Varun Raj
 
PDF
ReactJS presentation
Thanh Tuong
 
PPTX
Introduction to React
Rob Quick
 
PPTX
Its time to React.js
Ritesh Mehrotra
 
PDF
Introduction to React JS
Bethmi Gunasekara
 
PPTX
Introduction to React JS for beginners | Namespace IT
namespaceit
 
PPTX
React JS part 1
Diluka Wittahachchige
 
PPTX
React JS - A quick introduction tutorial
Mohammed Fazuluddin
 
Introduction to React JS for beginners
Varun Raj
 
ReactJS presentation
Thanh Tuong
 
Introduction to React
Rob Quick
 
Its time to React.js
Ritesh Mehrotra
 
Introduction to React JS
Bethmi Gunasekara
 
Introduction to React JS for beginners | Namespace IT
namespaceit
 
React JS part 1
Diluka Wittahachchige
 
React JS - A quick introduction tutorial
Mohammed Fazuluddin
 

What's hot (20)

PDF
An introduction to React.js
Emanuele DelBono
 
PDF
React JS - Introduction
Sergey Romaneko
 
PPTX
Intro to React
Justin Reock
 
PPTX
Introduction to React JS
Lohith Goudagere Nagaraj
 
ODP
Introduction to ReactJS
Knoldus Inc.
 
PPTX
React js programming concept
Tariqul islam
 
PPTX
React js
Alireza Akbari
 
PPTX
React js
Oswald Campesato
 
PPTX
Introduction to react_js
MicroPyramid .
 
PPTX
React JS: A Secret Preview
valuebound
 
PDF
Introduction to react
kiranabburi
 
PPTX
React workshop
Imran Sayed
 
PPTX
ReactJs
Sahana Banerjee
 
PDF
WEB DEVELOPMENT USING REACT JS
MuthuKumaran Singaravelu
 
PPTX
Introduction to React JS
Arnold Asllani
 
PPTX
Reactjs
Mallikarjuna G D
 
PPTX
React-JS.pptx
AnmolPandita7
 
PPTX
A Brief Introduction to React.js
Doug Neiner
 
PPTX
React js for beginners
Alessandro Valenti
 
PDF
React and redux
Mystic Coders, LLC
 
An introduction to React.js
Emanuele DelBono
 
React JS - Introduction
Sergey Romaneko
 
Intro to React
Justin Reock
 
Introduction to React JS
Lohith Goudagere Nagaraj
 
Introduction to ReactJS
Knoldus Inc.
 
React js programming concept
Tariqul islam
 
React js
Alireza Akbari
 
Introduction to react_js
MicroPyramid .
 
React JS: A Secret Preview
valuebound
 
Introduction to react
kiranabburi
 
React workshop
Imran Sayed
 
WEB DEVELOPMENT USING REACT JS
MuthuKumaran Singaravelu
 
Introduction to React JS
Arnold Asllani
 
React-JS.pptx
AnmolPandita7
 
A Brief Introduction to React.js
Doug Neiner
 
React js for beginners
Alessandro Valenti
 
React and redux
Mystic Coders, LLC
 
Ad

Viewers also liked (11)

PDF
WFD POSTER LANDSCAPE
Lotte Riddy
 
PDF
Socialmediaexaminer.Com Facebook 101 Business Guide | Social Media Exam...
atetrainingexpo
 
PDF
British Gas Simply Thank You Jan 2015
Paul Suter - 07957 933 584
 
PPTX
The Missing Feature: Blockchain contracts
Aeshan Wijetunge
 
PDF
A novel label-free cocaine assay based on aptamer-wrapped single-walled carbo...
Nanomedicine Journal (NMJ)
 
PDF
2768 la nueva_regulación_2004-2005[1]
Derechoycienciasjurìdicas Unicen La Paz
 
DOCX
Media conversation! assignment (1)
Mamadi Jaiteh
 
PPTX
Company law –a new beginning
Neha Godara
 
DOCX
Helpful Work for Mathematics
laluls212
 
PDF
An Intense Overview of the React Ecosystem
Rami Sayar
 
PPTX
EXTENT-2015: Efficient Risk Control - Challenges & Techniques
Iosif Itkin
 
WFD POSTER LANDSCAPE
Lotte Riddy
 
Socialmediaexaminer.Com Facebook 101 Business Guide | Social Media Exam...
atetrainingexpo
 
British Gas Simply Thank You Jan 2015
Paul Suter - 07957 933 584
 
The Missing Feature: Blockchain contracts
Aeshan Wijetunge
 
A novel label-free cocaine assay based on aptamer-wrapped single-walled carbo...
Nanomedicine Journal (NMJ)
 
2768 la nueva_regulación_2004-2005[1]
Derechoycienciasjurìdicas Unicen La Paz
 
Media conversation! assignment (1)
Mamadi Jaiteh
 
Company law –a new beginning
Neha Godara
 
Helpful Work for Mathematics
laluls212
 
An Intense Overview of the React Ecosystem
Rami Sayar
 
EXTENT-2015: Efficient Risk Control - Challenges & Techniques
Iosif Itkin
 
Ad

Similar to Introduction to react js (20)

PDF
FRONTEND DEVELOPMENT WITH REACT.JS
IRJET Journal
 
PPT
The Best Guide to Know What, Why, When to Use Is ReactJS
WeblineIndia
 
PDF
Master React in 20 Days !.pdf used for react
shameer200479
 
PDF
React js vs react native a comparative analysis
Shelly Megan
 
PDF
React Interview Question PDF By ScholarHat
Scholarhat
 
PDF
learning react
Eueung Mulyana
 
DOCX
Skill practical javascript diy projects
SkillPracticalEdTech
 
PPTX
React - Start learning today
Nitin Tyagi
 
PDF
From MVC to React
Eric Clemmons
 
PDF
Review on React JS
ijtsrd
 
PDF
Why React is the Future of Front-End Development
Elightwalk Technology PVT. LTD.
 
PDF
Why React is the Future of Front-End Development.pdf
Elightwalk Technology PVT. LTD.
 
PDF
Tech Talk on ReactJS
Atlogys Technical Consulting
 
PPTX
MVC & backbone.js
Mohammed Arif
 
PDF
Maximize Development Efficiency with ReactJS.pdf
BOSC Tech Labs
 
PPTX
React intro
PushkarThakur7
 
PPTX
React workshop presentation
Bojan Golubović
 
PDF
reactjs interview questions.pdf
rohityadav23214
 
PDF
Front End Development for Back End Java Developers - NYJavaSIG 2019
Matt Raible
 
PDF
React.js vs angular.js a comparison
Narola Infotech
 
FRONTEND DEVELOPMENT WITH REACT.JS
IRJET Journal
 
The Best Guide to Know What, Why, When to Use Is ReactJS
WeblineIndia
 
Master React in 20 Days !.pdf used for react
shameer200479
 
React js vs react native a comparative analysis
Shelly Megan
 
React Interview Question PDF By ScholarHat
Scholarhat
 
learning react
Eueung Mulyana
 
Skill practical javascript diy projects
SkillPracticalEdTech
 
React - Start learning today
Nitin Tyagi
 
From MVC to React
Eric Clemmons
 
Review on React JS
ijtsrd
 
Why React is the Future of Front-End Development
Elightwalk Technology PVT. LTD.
 
Why React is the Future of Front-End Development.pdf
Elightwalk Technology PVT. LTD.
 
Tech Talk on ReactJS
Atlogys Technical Consulting
 
MVC & backbone.js
Mohammed Arif
 
Maximize Development Efficiency with ReactJS.pdf
BOSC Tech Labs
 
React intro
PushkarThakur7
 
React workshop presentation
Bojan Golubović
 
reactjs interview questions.pdf
rohityadav23214
 
Front End Development for Back End Java Developers - NYJavaSIG 2019
Matt Raible
 
React.js vs angular.js a comparison
Narola Infotech
 

Recently uploaded (20)

PDF
5g is Reshaping the Competitive Landscape
Stellarix
 
PPTX
Google SGE SEO: 5 Critical Changes That Could Wreck Your Rankings in 2025
Reversed Out Creative
 
PDF
KIPER4D situs Exclusive Game dari server Star Gaming Asia
hokimamad0
 
PPTX
CSharp_Syntax_Basics.pptxxxxxxxxxxxxxxxxxxxxxxxxxxxx
nhdqw45qfd
 
PDF
Centralized Business Email Management_ How Admin Controls Boost Efficiency & ...
XgenPlus Technologies
 
PPTX
The Latest Scam Shocking the USA in 2025.pptx
onlinescamreport4
 
PPTX
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
PPTX
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
PDF
Latest Scam Shocking the USA in 2025.pdf
onlinescamreport4
 
PPTX
ppt lighfrsefsefesfesfsefsefsefsefserrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrt.pptx
atharvawafgaonkar
 
PPTX
EthicalHack{aksdladlsfsamnookfmnakoasjd}.pptx
dagarabull
 
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
APNIC
 
PDF
LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1
LABUAN 4D
 
PPTX
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 
PDF
DNSSEC Made Easy, presented at PHNOG 2025
APNIC
 
PPTX
AI ad its imp i military life read it ag
ShwetaBharti31
 
PDF
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
PPTX
nagasai stick diagrams in very large scale integratiom.pptx
manunagapaul
 
PPTX
how many elements are less than or equal to a mid value and adjusts the searc...
kokiyon104
 
PPTX
原版北不列颠哥伦比亚大学毕业证文凭UNBC成绩单2025年新版在线制作学位证书
e7nw4o4
 
5g is Reshaping the Competitive Landscape
Stellarix
 
Google SGE SEO: 5 Critical Changes That Could Wreck Your Rankings in 2025
Reversed Out Creative
 
KIPER4D situs Exclusive Game dari server Star Gaming Asia
hokimamad0
 
CSharp_Syntax_Basics.pptxxxxxxxxxxxxxxxxxxxxxxxxxxxx
nhdqw45qfd
 
Centralized Business Email Management_ How Admin Controls Boost Efficiency & ...
XgenPlus Technologies
 
The Latest Scam Shocking the USA in 2025.pptx
onlinescamreport4
 
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
Latest Scam Shocking the USA in 2025.pdf
onlinescamreport4
 
ppt lighfrsefsefesfesfsefsefsefsefserrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrt.pptx
atharvawafgaonkar
 
EthicalHack{aksdladlsfsamnookfmnakoasjd}.pptx
dagarabull
 
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
APNIC
 
LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1
LABUAN 4D
 
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 
DNSSEC Made Easy, presented at PHNOG 2025
APNIC
 
AI ad its imp i military life read it ag
ShwetaBharti31
 
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
nagasai stick diagrams in very large scale integratiom.pptx
manunagapaul
 
how many elements are less than or equal to a mid value and adjusts the searc...
kokiyon104
 
原版北不列颠哥伦比亚大学毕业证文凭UNBC成绩单2025年新版在线制作学位证书
e7nw4o4
 

Introduction to react js

Editor's Notes

  • #3: * 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.
  • #5: Use diagram example to highlight issues of code-reuse and app-maintence with app-functionality fragmented throughout the codebase.
  • #6: 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)
  • #7: 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.
  • #13: 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.
  • #18: 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)