SlideShare a Scribd company logo
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Agenda
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Why ReactJS?
Why do we need ReactJS?
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Why ReactJS
Remember the Facebook newsfeeds before
2009, when each time you had to refresh the
page for new updates ??
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Why ReactJS
Dispatcher
Initial Data
Real Time
Data
User Input
Store
ViewRefresh
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Why ReactJS
▪ Uses DOM (Document Object Model)
▪ More memory consumption
▪ Slow performance
Drawbacks Of Traditional Data Flow
DOM
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Why ReactJS
▪ Uses DOM (Document Object Model)
▪ More memory consumption
▪ Slow performance
Drawbacks Of Traditional Data Flow
DOM
DOM
DOM
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
React JS
1 2
43
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
React JS
101 2
43
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
React JS
1 2
43
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
React JS
2
43
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
React JS
101 2
43
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Why ReactJS?
Facebook after implementation of ReactJS became more user friendly. Each time new stories are
added, a New Stories notification appears. Clicking which will automatically refresh the news
feeds section.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Why ReactJS?
Dispatcher
Initial Data
Real Time
Data
User Input
Store
View
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Why ReactJS?
Dispatcher
Initial Data
Real Time
Data
User Input
Store
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Why ReactJS?
Dispatcher
Initial Data
Real Time
Data
User Input
Store
View
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Agenda
ReactJS Fundamentals
What Is ReactJS?
Hello World Program
ReactJS Installation
Advantages Of ReactJS
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
What Is ReactJS?
Now, let’s understand what is ReactJS.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
What Is ReactJS?
ReactJS is an open source JavaScript
library used to develop User Interfaces.
ReactJS was introduced by Facebook on May,
2013. It was open sourced in March, 2015.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
What Is ReactJS?
It is basically the View in MVC
(Model-View-Controller)
ReactJS is concerned with the components
that utilizes the expressiveness of JavaScript
with a HTML – like template syntax.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Aspects Of ReactJS?
Virtual DOM
Data Binding
Serverside Rendering
Patch
Virtual DOM Real DOM
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Aspects Of ReactJS?
Virtual DOM
Data Binding
Serverside Rendering One Way Data Binding
Action Dispatcher Store View
Action
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Aspects Of ReactJS?
Virtual DOM
Data Binding
Serverside Rendering
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Advantages of ReactJS
Let’s find out the advantages of ReactJS.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Advantages of ReactJS
Application’s performance is increased
Used on Client as well as Server Side
Readability is improved
Easily used with other frameworks
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
ReactJS Installation
Let’s get started with ReactJS.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
ReactJS Installation
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/JSXTransformer.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Add these <script> tags inside
<head> tag of your HTML code.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Hello World Program
Let’s start coding with ReactJS.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Hello World Program
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Hello World Program
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Hello World Program
This is how the output will look like:
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
ReactJS Fundamentals
Let’s find out about various concepts we just used in our code
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
1 2 6543 987
JSX
KeysEventsStatesComponents
RouterRefsLifecycleProps
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
2 6543 987
JSX
KeysEventsStatesComponents
RouterRefsLifecycleProps
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
JSX
✓ JSX stands for JavaScript XML
✓ Makes HTML easy to understand
✓ It is Robust
✓ Boosts up the JS performance
function intro(){
return <h1>Hello World!!</h1>;
}
JSX
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
JSX Uses
Embedding JavaScript
Specifying Attributes
JSX Nested Elements
Regular JSX var MyComponent = React.createClass({
render : function () {
return (
<div>
Hello World!!!
</div>
);
});
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
JSX Uses
Embedding JavaScript
Specifying Attributes
JSX Nested Elements
Regular JSX
var MyComponent = React.createClass( {
render : function () {
return (
<div>
<h1>Header</h1>
<h2>Content</h2>
<p>This is the content!!!</p>
</div>
);
}
});
<h1>,<h2>,<p> nested
inside <div>
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
JSX Uses
Embedding JavaScript
Specifying Attributes
JSX Nested Elements
Regular JSX
var styles={ backgroundcolor: ’cyan’};
var MyComponent=React.createClass({
render : function () {
return (
<div style={styles}>
<h1>Header</h1>
</div>
);
}
});
Adding Attributes
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
JSX Uses
Embedding JavaScript
Specifying Attributes
JSX Nested Elements
Regular JSX
var MyComponent = React.createClass({
render: function () {
return(
<div>
<h2> {2+4} </h2>
</div>
);
}
});
JavaScript Expression
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
1 2 6543 987
JSX
KeysEventsStates
Components
RouterRefsLifecycleProps
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Components
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Components
Component 1
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Components
Component 2
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Components
Component 3
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Everything in ReactJS is component1
Each Component Return a DOM Object2
It splits the UI into independent reusable pieces3
Each independent piece is processed separately4
It can refer other components in output5
It can be further split into smaller components6
Components
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Components
✓ A valid React component, accepts a single ‘props’ object argument to produce a React element.
✓ These are called “functional” as they literally are JavaScript functions.
<button onClick={this.handleClick}>Click Here</button>
Prop
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Components
Simplest way of defining a
component is through JavaScript
STATEFUL
STATELESS
<Component/>
STATELESS
<Component/>
Components in ReactJS can be in two forms:
1. Stateful: Remembers everything it does
2. Stateless: Doesn’t remembers anything it does.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Stateful Components
1
Core which stores information about components state in memory
2
Can change states
3
Contains knowledge of past, current and possible future state changes
4
Receives information from the stateless components if state change is required
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Stateless Components
1
Calculates states internal state of components
2
Never changes the state
3
Contains no knowledge of past, current and possible future state changes
4
Provides Referential Transparency i.e for same inputs will produce same output
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
1 2 6543 987
JSX
KeysEventsStatesComponents
RouterRefsLifecycle
Props
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Props
✓ Props are read-only components
✓ Whether components are declared as function or class, it must never change its props
✓ Such components are called ‘pure functions’
RULE: All React components must act like pure functions with respect to their props.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
1 2 6543 987
JSX
KeysEvents
States
Components
RouterRefsLifecycleProps
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
States
✓ Heart of react components
✓ Must be kept as simple as possible
✓ Determines components rendering and behavior
✓ Creates dynamic and interactive components
Components
Components
Components
Components
Components
Props Props
Props Props
State
State
State
State
Props
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
1 2 6543 987
JSX
KeysEventsStatesComponents
RouterRefs
Lifecycle
Props
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Lifecycle
React provides various methods which notifies when certain stage of the lifecycle occurs called Lifecycle methods
✓ These are special event handlers that are called at
various points in components life
✓ Code can be added to them to perform various tasks
✓ They are invoked in a predictable order
✓ Entire lifecycle is divided into 4 phases.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Initial Phase
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Updating Phase
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Props Change Phase
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Unmounting Phase
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
1 2 6543 987
JSX
Keys
Events
StatesComponents
RouterRefsLifecycleProps
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Events
Events are the triggered reactions to specific actions like mouse hover, mouse click, key press etc.
React
Component
Action
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Events
Events are the triggered reactions to specific actions like mouse hover, mouse click, key press etc.
React
Event
React
Component
Action
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Events
✓ Events pass event arguments to the event handler
✓ Whenever an event is specified in JSX, a synthetic event is generated
✓ This synthetic event wraps up the browsers native event and are passed as argument to the
event handler
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Event
button
button
button
Event handler
Event handler
Event handler
Event listener
Event listener
Event listener
In other UI
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Event
button
button
button
Event
handler
Event
handler
Event
handler
Event listener
Event listener
Event listener
button
button
button Event handler
Event listener
In ReactIn other UI
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
1 2 6543 987
JSX
KeysEventsStatesComponents
Router
Refs
LifecycleProps
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Refs
✓ Refs stands for references
✓ Refs are used to return references to a particular element or component returned by render().
React Element
render(){
}
<Component/>
ref
render() {
}
ref
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
➢ Managing focus, text selection or media playback
Refs Use Cases
➢ Triggering imperative animations
➢ Integrating with third-party DOM libraries
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
1 2 6543 987
JSX
Keys
EventsStatesComponents
RouterRefsLifecycleProps
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Keys
Key =101
Key=102
render()
render()
React
Elements
Keys are the elements which helps React to identify components uniquely
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Keys
Key =101
Key=103
render()
render()
React
Elements
Keys are the elements which helps React to identify components uniquely
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
1 2 6543 987
JSX
KeysEventsStatesComponents
Router
RefsLifecycleProps
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Router
✓ React Router is a powerful routing library built on top of React Framework.
✓ It helps in adding new screens and flows to the application very quickly.
✓ It keeps the URL in sync with data that’s being displayed on the web page.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Router Advantages
Easily understands the application views.1
It can restore any state and view with simple URL.2
It handles nested views and the resolutions.3
State can be restored by the user by moving backward and forward.4
It maintains a standardized structure and behavior.5
While navigating it can do implicit CSS transitions.6
Copyright © 2017, edureka and/or its affiliates. All rights reserved.

More Related Content

What's hot (20)

PPTX
Introduction to React JS for beginners | Namespace IT
namespaceit
 
PPTX
Reactjs
Mallikarjuna G D
 
PPTX
React JS: A Secret Preview
valuebound
 
PDF
React js
Rajesh Kolla
 
PPTX
React workshop
Imran Sayed
 
PPTX
React js programming concept
Tariqul islam
 
PDF
React for Beginners
Derek Willian Stavis
 
PDF
ReactJS
Hiten Pratap Singh
 
PDF
React JS - Introduction
Sergey Romaneko
 
PDF
React Components Lifecycle | React Tutorial for Beginners | ReactJS Training ...
Edureka!
 
PPTX
React-JS Component Life-cycle Methods
ANKUSH CHAVAN
 
ODP
Introduction to ReactJS
Knoldus Inc.
 
PDF
ReactJS presentation
Thanh Tuong
 
PPTX
Intro to React
Justin Reock
 
PDF
Introduction to Redux
Ignacio Martín
 
PDF
react redux.pdf
Knoldus Inc.
 
PDF
An Introduction to Redux
NexThoughts Technologies
 
PPTX
React hooks
Assaf Gannon
 
PDF
An introduction to React.js
Emanuele DelBono
 
Introduction to React JS for beginners | Namespace IT
namespaceit
 
React JS: A Secret Preview
valuebound
 
React js
Rajesh Kolla
 
React workshop
Imran Sayed
 
React js programming concept
Tariqul islam
 
React for Beginners
Derek Willian Stavis
 
React JS - Introduction
Sergey Romaneko
 
React Components Lifecycle | React Tutorial for Beginners | ReactJS Training ...
Edureka!
 
React-JS Component Life-cycle Methods
ANKUSH CHAVAN
 
Introduction to ReactJS
Knoldus Inc.
 
ReactJS presentation
Thanh Tuong
 
Intro to React
Justin Reock
 
Introduction to Redux
Ignacio Martín
 
react redux.pdf
Knoldus Inc.
 
An Introduction to Redux
NexThoughts Technologies
 
React hooks
Assaf Gannon
 
An introduction to React.js
Emanuele DelBono
 

Viewers also liked (20)

PDF
What is Artificial Intelligence | Artificial Intelligence Tutorial For Beginn...
Edureka!
 
PDF
Angular 4 Data Binding | Two Way Data Binding in Angular 4 | Angular 4 Tutori...
Edureka!
 
PDF
Introduction To TensorFlow | Deep Learning Using TensorFlow | TensorFlow Tuto...
Edureka!
 
PPTX
Harry Surden - Artificial Intelligence and Law Overview
Harry Surden
 
PPTX
Top 5 Deep Learning and AI Stories - October 6, 2017
NVIDIA
 
PDF
The AI Rush
Jean-Baptiste Dumont
 
PPTX
AI and Machine Learning Demystified by Carol Smith at Midwest UX 2017
Carol Smith
 
PDF
Cloud Computing Tutorial For Beginners | What is Cloud Computing | AWS Traini...
Edureka!
 
PDF
Voice Assistants: Neuigkeiten von Alexa und Google Home
inovex GmbH
 
PDF
IoT showdown: Amazon Echo vs Google Home
Comrade
 
PDF
Google Home
Sharon Flaherty
 
PPT
Siri Vs Google Now
MeasurementMarketing.io
 
PPTX
Oficinas de Proyectos Eficientes con Microsoft EPM 2010 (en Microsoft Uruguay)
Walter Ariel Risi
 
PPTX
Importancia de las tic en la educación 3
lucerito8
 
PPTX
Web social
Gianina Villar Soto
 
PPTX
negociaciones de Epm
estefaniayaquer
 
PPTX
Presentación Juan David Echeverri EPM
CQC MCI
 
PDF
What Is DevOps? | Introduction To DevOps | DevOps Tools | DevOps Tutorial | D...
Edureka!
 
PDF
13 caso-epm
Andesco
 
PPT
Taller Administración del tiempo
Gustavo Villegas L.
 
What is Artificial Intelligence | Artificial Intelligence Tutorial For Beginn...
Edureka!
 
Angular 4 Data Binding | Two Way Data Binding in Angular 4 | Angular 4 Tutori...
Edureka!
 
Introduction To TensorFlow | Deep Learning Using TensorFlow | TensorFlow Tuto...
Edureka!
 
Harry Surden - Artificial Intelligence and Law Overview
Harry Surden
 
Top 5 Deep Learning and AI Stories - October 6, 2017
NVIDIA
 
AI and Machine Learning Demystified by Carol Smith at Midwest UX 2017
Carol Smith
 
Cloud Computing Tutorial For Beginners | What is Cloud Computing | AWS Traini...
Edureka!
 
Voice Assistants: Neuigkeiten von Alexa und Google Home
inovex GmbH
 
IoT showdown: Amazon Echo vs Google Home
Comrade
 
Google Home
Sharon Flaherty
 
Siri Vs Google Now
MeasurementMarketing.io
 
Oficinas de Proyectos Eficientes con Microsoft EPM 2010 (en Microsoft Uruguay)
Walter Ariel Risi
 
Importancia de las tic en la educación 3
lucerito8
 
negociaciones de Epm
estefaniayaquer
 
Presentación Juan David Echeverri EPM
CQC MCI
 
What Is DevOps? | Introduction To DevOps | DevOps Tools | DevOps Tutorial | D...
Edureka!
 
13 caso-epm
Andesco
 
Taller Administración del tiempo
Gustavo Villegas L.
 
Ad

Similar to ReactJS Tutorial For Beginners | ReactJS Redux Training For Beginners | React Tutorial | Edureka (20)

PDF
React Redux Tutorial | Redux Tutorial for Beginners | React Redux Training | ...
Edureka!
 
PDF
React Interview Questions and Answers | React Tutorial | React Redux Online T...
Edureka!
 
PDF
What Is React | ReactJS Tutorial for Beginners | ReactJS Training | Edureka
Edureka!
 
PDF
Learn react by Etietop Demas
Etietop Demas
 
PDF
React vs Angular 4 | Angular 2 vs React | React & Angular | ReactJS Training ...
Edureka!
 
PDF
Elasticsearch Tutorial | Getting Started with Elasticsearch | ELK Stack Train...
Edureka!
 
PDF
React Best Practices All Developers Should Follow in 2024.pdf
BOSC Tech Labs
 
PDF
Java 9 New Features | Java Tutorial | What’s New in Java 9 | Java 9 Features ...
Edureka!
 
PPTX
what is context API and How it works in React.pptx
BOSC Tech Labs
 
PDF
Angular 4 Components | Angular 4 Tutorial For Beginners | Learn Angular 4 | E...
Edureka!
 
PPTX
slides.pptx
HafidzIhzaPratama
 
PPTX
slides.pptx
HarshitJain302462
 
PPTX
Let's react - Meetup
RAJNISH KATHAROTIYA
 
PDF
Creating a Facebook Clone - Part XVII - Transcript.pdf
ShaiAlmog1
 
PPTX
How to Become ReactJS Developer?
Intellipaat
 
PDF
Python Django tutorial | Getting Started With Django | Web Development With D...
Edureka!
 
PDF
React HOCs, Context and Observables
Trayan Iliev
 
PDF
How To Become A Big Data Engineer? Edureka
Edureka!
 
PPTX
Its time to React.js
Ritesh Mehrotra
 
PPTX
React - Start learning today
Nitin Tyagi
 
React Redux Tutorial | Redux Tutorial for Beginners | React Redux Training | ...
Edureka!
 
React Interview Questions and Answers | React Tutorial | React Redux Online T...
Edureka!
 
What Is React | ReactJS Tutorial for Beginners | ReactJS Training | Edureka
Edureka!
 
Learn react by Etietop Demas
Etietop Demas
 
React vs Angular 4 | Angular 2 vs React | React & Angular | ReactJS Training ...
Edureka!
 
Elasticsearch Tutorial | Getting Started with Elasticsearch | ELK Stack Train...
Edureka!
 
React Best Practices All Developers Should Follow in 2024.pdf
BOSC Tech Labs
 
Java 9 New Features | Java Tutorial | What’s New in Java 9 | Java 9 Features ...
Edureka!
 
what is context API and How it works in React.pptx
BOSC Tech Labs
 
Angular 4 Components | Angular 4 Tutorial For Beginners | Learn Angular 4 | E...
Edureka!
 
slides.pptx
HafidzIhzaPratama
 
slides.pptx
HarshitJain302462
 
Let's react - Meetup
RAJNISH KATHAROTIYA
 
Creating a Facebook Clone - Part XVII - Transcript.pdf
ShaiAlmog1
 
How to Become ReactJS Developer?
Intellipaat
 
Python Django tutorial | Getting Started With Django | Web Development With D...
Edureka!
 
React HOCs, Context and Observables
Trayan Iliev
 
How To Become A Big Data Engineer? Edureka
Edureka!
 
Its time to React.js
Ritesh Mehrotra
 
React - Start learning today
Nitin Tyagi
 
Ad

More from Edureka! (20)

PDF
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
PDF
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
PDF
Tableau Tutorial for Data Science | Edureka
Edureka!
 
PDF
Python Programming Tutorial | Edureka
Edureka!
 
PDF
Top 5 PMP Certifications | Edureka
Edureka!
 
PDF
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
PDF
Linux Mint Tutorial | Edureka
Edureka!
 
PDF
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
PDF
Importance of Digital Marketing | Edureka
Edureka!
 
PDF
RPA in 2020 | Edureka
Edureka!
 
PDF
Email Notifications in Jenkins | Edureka
Edureka!
 
PDF
EA Algorithm in Machine Learning | Edureka
Edureka!
 
PDF
Cognitive AI Tutorial | Edureka
Edureka!
 
PDF
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
PDF
Blue Prism Top Interview Questions | Edureka
Edureka!
 
PDF
Big Data on AWS Tutorial | Edureka
Edureka!
 
PDF
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
PDF
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
PDF
Introduction to DevOps | Edureka
Edureka!
 
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux Mint Tutorial | Edureka
Edureka!
 
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Edureka!
 
Big Data on AWS Tutorial | Edureka
Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Edureka!
 

Recently uploaded (20)

PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
July Patch Tuesday
Ivanti
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PPTX
Designing Production-Ready AI Agents
Kunal Rai
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
July Patch Tuesday
Ivanti
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Designing Production-Ready AI Agents
Kunal Rai
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
Biography of Daniel Podor.pdf
Daniel Podor
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 

ReactJS Tutorial For Beginners | ReactJS Redux Training For Beginners | React Tutorial | Edureka

  • 1. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Agenda
  • 2. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Why ReactJS? Why do we need ReactJS?
  • 3. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Why ReactJS Remember the Facebook newsfeeds before 2009, when each time you had to refresh the page for new updates ??
  • 4. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Why ReactJS Dispatcher Initial Data Real Time Data User Input Store ViewRefresh
  • 5. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Why ReactJS ▪ Uses DOM (Document Object Model) ▪ More memory consumption ▪ Slow performance Drawbacks Of Traditional Data Flow DOM
  • 6. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Why ReactJS ▪ Uses DOM (Document Object Model) ▪ More memory consumption ▪ Slow performance Drawbacks Of Traditional Data Flow DOM DOM DOM
  • 7. Copyright © 2017, edureka and/or its affiliates. All rights reserved. React JS 1 2 43
  • 8. Copyright © 2017, edureka and/or its affiliates. All rights reserved. React JS 101 2 43
  • 9. Copyright © 2017, edureka and/or its affiliates. All rights reserved. React JS 1 2 43
  • 10. Copyright © 2017, edureka and/or its affiliates. All rights reserved. React JS 2 43
  • 11. Copyright © 2017, edureka and/or its affiliates. All rights reserved. React JS 101 2 43
  • 12. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Why ReactJS? Facebook after implementation of ReactJS became more user friendly. Each time new stories are added, a New Stories notification appears. Clicking which will automatically refresh the news feeds section.
  • 13. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Why ReactJS? Dispatcher Initial Data Real Time Data User Input Store View
  • 14. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Why ReactJS? Dispatcher Initial Data Real Time Data User Input Store
  • 15. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Why ReactJS? Dispatcher Initial Data Real Time Data User Input Store View
  • 16. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Agenda ReactJS Fundamentals What Is ReactJS? Hello World Program ReactJS Installation Advantages Of ReactJS
  • 17. Copyright © 2017, edureka and/or its affiliates. All rights reserved. What Is ReactJS? Now, let’s understand what is ReactJS.
  • 18. Copyright © 2017, edureka and/or its affiliates. All rights reserved. What Is ReactJS? ReactJS is an open source JavaScript library used to develop User Interfaces. ReactJS was introduced by Facebook on May, 2013. It was open sourced in March, 2015.
  • 19. Copyright © 2017, edureka and/or its affiliates. All rights reserved. What Is ReactJS? It is basically the View in MVC (Model-View-Controller) ReactJS is concerned with the components that utilizes the expressiveness of JavaScript with a HTML – like template syntax.
  • 20. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Aspects Of ReactJS? Virtual DOM Data Binding Serverside Rendering Patch Virtual DOM Real DOM
  • 21. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Aspects Of ReactJS? Virtual DOM Data Binding Serverside Rendering One Way Data Binding Action Dispatcher Store View Action
  • 22. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Aspects Of ReactJS? Virtual DOM Data Binding Serverside Rendering
  • 23. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Advantages of ReactJS Let’s find out the advantages of ReactJS.
  • 24. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Advantages of ReactJS Application’s performance is increased Used on Client as well as Server Side Readability is improved Easily used with other frameworks
  • 25. Copyright © 2017, edureka and/or its affiliates. All rights reserved. ReactJS Installation Let’s get started with ReactJS.
  • 26. Copyright © 2017, edureka and/or its affiliates. All rights reserved. ReactJS Installation <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/JSXTransformer.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> Add these <script> tags inside <head> tag of your HTML code.
  • 27. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Hello World Program Let’s start coding with ReactJS.
  • 28. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Hello World Program
  • 29. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Hello World Program
  • 30. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Hello World Program This is how the output will look like:
  • 31. Copyright © 2017, edureka and/or its affiliates. All rights reserved. ReactJS Fundamentals Let’s find out about various concepts we just used in our code
  • 32. Copyright © 2017, edureka and/or its affiliates. All rights reserved. 1 2 6543 987 JSX KeysEventsStatesComponents RouterRefsLifecycleProps
  • 33. Copyright © 2017, edureka and/or its affiliates. All rights reserved. 2 6543 987 JSX KeysEventsStatesComponents RouterRefsLifecycleProps
  • 34. Copyright © 2017, edureka and/or its affiliates. All rights reserved. JSX ✓ JSX stands for JavaScript XML ✓ Makes HTML easy to understand ✓ It is Robust ✓ Boosts up the JS performance function intro(){ return <h1>Hello World!!</h1>; } JSX
  • 35. Copyright © 2017, edureka and/or its affiliates. All rights reserved. JSX Uses Embedding JavaScript Specifying Attributes JSX Nested Elements Regular JSX var MyComponent = React.createClass({ render : function () { return ( <div> Hello World!!! </div> ); });
  • 36. Copyright © 2017, edureka and/or its affiliates. All rights reserved. JSX Uses Embedding JavaScript Specifying Attributes JSX Nested Elements Regular JSX var MyComponent = React.createClass( { render : function () { return ( <div> <h1>Header</h1> <h2>Content</h2> <p>This is the content!!!</p> </div> ); } }); <h1>,<h2>,<p> nested inside <div>
  • 37. Copyright © 2017, edureka and/or its affiliates. All rights reserved. JSX Uses Embedding JavaScript Specifying Attributes JSX Nested Elements Regular JSX var styles={ backgroundcolor: ’cyan’}; var MyComponent=React.createClass({ render : function () { return ( <div style={styles}> <h1>Header</h1> </div> ); } }); Adding Attributes
  • 38. Copyright © 2017, edureka and/or its affiliates. All rights reserved. JSX Uses Embedding JavaScript Specifying Attributes JSX Nested Elements Regular JSX var MyComponent = React.createClass({ render: function () { return( <div> <h2> {2+4} </h2> </div> ); } }); JavaScript Expression
  • 39. Copyright © 2017, edureka and/or its affiliates. All rights reserved. 1 2 6543 987 JSX KeysEventsStates Components RouterRefsLifecycleProps
  • 40. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Components
  • 41. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Components Component 1
  • 42. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Components Component 2
  • 43. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Components Component 3
  • 44. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Everything in ReactJS is component1 Each Component Return a DOM Object2 It splits the UI into independent reusable pieces3 Each independent piece is processed separately4 It can refer other components in output5 It can be further split into smaller components6 Components
  • 45. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Components ✓ A valid React component, accepts a single ‘props’ object argument to produce a React element. ✓ These are called “functional” as they literally are JavaScript functions. <button onClick={this.handleClick}>Click Here</button> Prop
  • 46. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Components Simplest way of defining a component is through JavaScript STATEFUL STATELESS <Component/> STATELESS <Component/> Components in ReactJS can be in two forms: 1. Stateful: Remembers everything it does 2. Stateless: Doesn’t remembers anything it does.
  • 47. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Stateful Components 1 Core which stores information about components state in memory 2 Can change states 3 Contains knowledge of past, current and possible future state changes 4 Receives information from the stateless components if state change is required
  • 48. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Stateless Components 1 Calculates states internal state of components 2 Never changes the state 3 Contains no knowledge of past, current and possible future state changes 4 Provides Referential Transparency i.e for same inputs will produce same output
  • 49. Copyright © 2017, edureka and/or its affiliates. All rights reserved. 1 2 6543 987 JSX KeysEventsStatesComponents RouterRefsLifecycle Props
  • 50. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Props ✓ Props are read-only components ✓ Whether components are declared as function or class, it must never change its props ✓ Such components are called ‘pure functions’ RULE: All React components must act like pure functions with respect to their props.
  • 51. Copyright © 2017, edureka and/or its affiliates. All rights reserved. 1 2 6543 987 JSX KeysEvents States Components RouterRefsLifecycleProps
  • 52. Copyright © 2017, edureka and/or its affiliates. All rights reserved. States ✓ Heart of react components ✓ Must be kept as simple as possible ✓ Determines components rendering and behavior ✓ Creates dynamic and interactive components Components Components Components Components Components Props Props Props Props State State State State Props
  • 53. Copyright © 2017, edureka and/or its affiliates. All rights reserved. 1 2 6543 987 JSX KeysEventsStatesComponents RouterRefs Lifecycle Props
  • 54. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Lifecycle React provides various methods which notifies when certain stage of the lifecycle occurs called Lifecycle methods ✓ These are special event handlers that are called at various points in components life ✓ Code can be added to them to perform various tasks ✓ They are invoked in a predictable order ✓ Entire lifecycle is divided into 4 phases.
  • 55. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Initial Phase
  • 56. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Updating Phase
  • 57. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Props Change Phase
  • 58. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Unmounting Phase
  • 59. Copyright © 2017, edureka and/or its affiliates. All rights reserved. 1 2 6543 987 JSX Keys Events StatesComponents RouterRefsLifecycleProps
  • 60. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Events Events are the triggered reactions to specific actions like mouse hover, mouse click, key press etc. React Component Action
  • 61. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Events Events are the triggered reactions to specific actions like mouse hover, mouse click, key press etc. React Event React Component Action
  • 62. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Events ✓ Events pass event arguments to the event handler ✓ Whenever an event is specified in JSX, a synthetic event is generated ✓ This synthetic event wraps up the browsers native event and are passed as argument to the event handler
  • 63. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Event button button button Event handler Event handler Event handler Event listener Event listener Event listener In other UI
  • 64. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Event button button button Event handler Event handler Event handler Event listener Event listener Event listener button button button Event handler Event listener In ReactIn other UI
  • 65. Copyright © 2017, edureka and/or its affiliates. All rights reserved. 1 2 6543 987 JSX KeysEventsStatesComponents Router Refs LifecycleProps
  • 66. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Refs ✓ Refs stands for references ✓ Refs are used to return references to a particular element or component returned by render(). React Element render(){ } <Component/> ref render() { } ref
  • 67. Copyright © 2017, edureka and/or its affiliates. All rights reserved. ➢ Managing focus, text selection or media playback Refs Use Cases ➢ Triggering imperative animations ➢ Integrating with third-party DOM libraries
  • 68. Copyright © 2017, edureka and/or its affiliates. All rights reserved. 1 2 6543 987 JSX Keys EventsStatesComponents RouterRefsLifecycleProps
  • 69. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Keys Key =101 Key=102 render() render() React Elements Keys are the elements which helps React to identify components uniquely
  • 70. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Keys Key =101 Key=103 render() render() React Elements Keys are the elements which helps React to identify components uniquely
  • 71. Copyright © 2017, edureka and/or its affiliates. All rights reserved. 1 2 6543 987 JSX KeysEventsStatesComponents Router RefsLifecycleProps
  • 72. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Router ✓ React Router is a powerful routing library built on top of React Framework. ✓ It helps in adding new screens and flows to the application very quickly. ✓ It keeps the URL in sync with data that’s being displayed on the web page.
  • 73. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Router Advantages Easily understands the application views.1 It can restore any state and view with simple URL.2 It handles nested views and the resolutions.3 State can be restored by the user by moving backward and forward.4 It maintains a standardized structure and behavior.5 While navigating it can do implicit CSS transitions.6
  • 74. Copyright © 2017, edureka and/or its affiliates. All rights reserved.