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

PDF
React JS - Introduction
ODP
Introduction to ReactJS
PDF
ReactJS presentation
PPTX
Introduction to React JS
PDF
Introduction to React JS
PPTX
React JS - A quick introduction tutorial
PPTX
Introduction to React JS for beginners | Namespace IT
PPTX
React JS: A Secret Preview
React JS - Introduction
Introduction to ReactJS
ReactJS presentation
Introduction to React JS
Introduction to React JS
React JS - A quick introduction tutorial
Introduction to React JS for beginners | Namespace IT
React JS: A Secret Preview

What's hot (20)

PDF
An introduction to React.js
PPTX
PPTX
React workshop
PDF
PPTX
Introduction to React
PPTX
PPTX
React js - The Core Concepts
PPTX
reactJS
PPTX
Intro to React
PPTX
React workshop presentation
PPTX
Its time to React.js
PDF
React&redux
PPTX
Understanding react hooks
PPT
React js
PPTX
Introduction to React JS for beginners
PDF
React js
PPTX
Reactjs
PDF
Introduction to Redux
PPTX
ReactJs presentation
PPTX
React hooks
An introduction to React.js
React workshop
Introduction to React
React js - The Core Concepts
reactJS
Intro to React
React workshop presentation
Its time to React.js
React&redux
Understanding react hooks
React js
Introduction to React JS for beginners
React js
Reactjs
Introduction to Redux
ReactJs presentation
React hooks
Ad

Viewers also liked (11)

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

Similar to Introduction to react js (20)

PDF
FRONTEND DEVELOPMENT WITH REACT.JS
PPT
The Best Guide to Know What, Why, When to Use Is ReactJS
PDF
Master React in 20 Days !.pdf used for react
PDF
React js vs react native a comparative analysis
PDF
React Interview Question PDF By ScholarHat
PPTX
PDF
learning react
PPTX
React JS part 1
DOCX
Skill practical javascript diy projects
PPTX
React - Start learning today
PDF
From MVC to React
PDF
Review on React JS
PDF
Why React is the Future of Front-End Development
PDF
Why React is the Future of Front-End Development.pdf
PDF
Tech Talk on ReactJS
PPTX
MVC & backbone.js
PDF
Maximize Development Efficiency with ReactJS.pdf
PPTX
React intro
PDF
reactjs interview questions.pdf
PDF
Front End Development for Back End Java Developers - NYJavaSIG 2019
FRONTEND DEVELOPMENT WITH REACT.JS
The Best Guide to Know What, Why, When to Use Is ReactJS
Master React in 20 Days !.pdf used for react
React js vs react native a comparative analysis
React Interview Question PDF By ScholarHat
learning react
React JS part 1
Skill practical javascript diy projects
React - Start learning today
From MVC to React
Review on React JS
Why React is the Future of Front-End Development
Why React is the Future of Front-End Development.pdf
Tech Talk on ReactJS
MVC & backbone.js
Maximize Development Efficiency with ReactJS.pdf
React intro
reactjs interview questions.pdf
Front End Development for Back End Java Developers - NYJavaSIG 2019

Recently uploaded (20)

PPT
tcp ip networks nd ip layering assotred slides
PPTX
Introuction about WHO-FIC in ICD-10.pptx
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPTX
artificialintelligenceai1-copy-210604123353.pptx
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PPTX
Digital Literacy And Online Safety on internet
PDF
Paper PDF World Game (s) Great Redesign.pdf
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PPTX
SAP Ariba Sourcing PPT for learning material
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPTX
international classification of diseases ICD-10 review PPT.pptx
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PDF
Introduction to the IoT system, how the IoT system works
DOCX
Unit-3 cyber security network security of internet system
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PPTX
Introduction to Information and Communication Technology
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PDF
Exploring VPS Hosting Trends for SMBs in 2025
tcp ip networks nd ip layering assotred slides
Introuction about WHO-FIC in ICD-10.pptx
Slides PPTX World Game (s) Eco Economic Epochs.pptx
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
artificialintelligenceai1-copy-210604123353.pptx
PptxGenJS_Demo_Chart_20250317130215833.pptx
SASE Traffic Flow - ZTNA Connector-1.pdf
Digital Literacy And Online Safety on internet
Paper PDF World Game (s) Great Redesign.pdf
Unit-1 introduction to cyber security discuss about how to secure a system
SAP Ariba Sourcing PPT for learning material
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
international classification of diseases ICD-10 review PPT.pptx
Design_with_Watersergyerge45hrbgre4top (1).ppt
Introduction to the IoT system, how the IoT system works
Unit-3 cyber security network security of internet system
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
Introduction to Information and Communication Technology
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
Exploring VPS Hosting Trends for SMBs in 2025

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)