SlideShare a Scribd company logo
Let’s React
By Rajnish Katharotiya
Front-end Engineer @knovator
Topics
➔ Introduction of ReactJS.
➔ Component workflow.
➔ State management and useful life-cycles.
➔ React hooks.
➔ Server Side Rendering.
React Introduction
- React is an javascript library for building user
interface.
✅ Following
👆
✅ Following
React Introduction
- Initialise app.
npx create-react-app my-app //cra boilerplate
cd my-app
npm start
React Introduction
- Render app into Actual DOM.
ReactDOM.render(
<APP />,
document.getElementById('root')
)
<!DOCTYPE Html>
<html>
<head>...</head>
<body>
<div id="root" />
</body>
</html>
/public/index.html
/src/index.js
Compiled JSX syntax
What is JSX ??
JSX is basically a
syntax extension
of regular
JavaScript and is
used to create
React elements.
These elements are
then rendered to
the React DOM.
import React from 'react';
const App = () => ( <h1>Hello</h1> );
export default App;
/app.js
Components
class Profile extends Component {
state = {
followBtnText: 'Following'
};
render() {
const { state } = this;
return ( <Button {...state} /> );
}
}
/Profile.js - class
const Button = ({followBtnText}) =>
{
return (
<button>
{followBtnText}
</button>
);
};
/Button.js - functional
What is state?
In the React sense,
“state” is an object that
represents the parts of
the app that can
change. Each
component can
maintain its own state,
which lives in an object
called this. state
class Profile extends Component {
constructor(props){
super(props);
state = {
followBtnText : “Follow”
};
}
componentDidMount(){
this.setState({ followBtnText: “Following” })
}
render() {
const { state } = this;
return ( <Button {...state} /> );
}
}
/Profile.js
What is Props ?
class Profile extends Component {
constructor(props){
super(props);
state = { userName : 'John Doe' };
}
componentDidMount(){
this.setState({ ...this.props })
}
render() {
const { state } = this;
return ( <Name {...state} /> );
// return ( <Name userName={state.userName} />
)
}
/Profile.js
const Name = (props) => {
const { userName } = props;
return (
<h1>{userName}</h1>
);
};
/Name.js
Complexity of state/props
- Global State
management
- Store
- Actions
- Reducers
Redux
Lifecycles
- Each Component has lifecycle which you can monitor and
manipulate during its phases.
Useful Lifecycles
➔ componentWillMount()
➔ render()
➔ componentDidMount()
➔ componentWillReceiveProps() / componentDidUpdate()
➔ shouldComponentUpdate()
➔ componentWillUnmount()
React Hook
- Function to hook with state and Lifecycle of functional
component.
const Profile = () => {
const [ followStatus, setFollowStatus ] = useState(‘Follow’);
return ( <Button followStatus={followStatus} /> );
}
/Profile.js
React Hook - On Mount
const TopPicks = (props) => {
const [ list, setList ] = useState([]);
useEffect( () => {
const list = getTopPicksByUser();
setList(list);
}, [] );
return ( <Videos list={list} /> );
}
/TopPicks.js
React Hook - On Update
const VideoItem = (props) => {
const [ progress, setProgress ] =
useState(‘’);
useEffect( () => {
setProgress( props.progress );
}, [ props.progress ] );
return ( <ProgressBar progress={progress} /> );
}
/VideoItem.js
React Hook - On Unmount
const UserStatus = (props) => {
const [ staus, setStatus ] = useState(‘Active’);
useEffect( () => {
getUserStatus.subscribe(setStatus);
return () => getUserStatus.unsubscribe(setStatus);
}, [] );
return status;
}
/app.js
Server Side Rendering
- SSR is the ability of a front-end framework to render
markup while running on a back-end system.
➔ Performance benefit for our customer.
➔ Faster time for an initial page render.
➔ Consistent SEO performance.
Why SSR?
Overview - Client Side Rendering
- Browser download the javascript and then use it to
execute content.
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<link href="/style.css" rel="stylesheet"/>
<title>Knovator</title>
<link rel="icon" href="/favicon.png" type="image/gif" sizes="16x16">
</head>
<body>
<div id="root"></div>
<script src="/index.js" type="text/javascript"></script>
<script src="/vendor.js" type="text/javascript"></script>
</body>
</html>
Understand with example
https://www.pokemon.com/
Pokemon - Get #1
Browser Server
<html lang="en">
<head>
<link href="/style.css" rel="stylesheet"/>
</head>
<body>
<div id="root"></div>
<script src="/index.js" type="text/javascript"></script>
</body>
</html>
GET /
index.html
Pokemon - View #1
https://www.pokemon.com/
Pokemon - Get #2
Browser Server
GET /index.js
index.js
Pokemon - View #2
https://www.pokemon.com/
- Thousands lines of
javascript code
prased.
- Script execution
begin.
- ReactDOM render.
Pokemon - Get #3
Browser
Pokemon
Server
GET /api/pokemon
Pokemon
https://www.pokemon.com/
Request Overview
https://www.pokemon.com/ https://www.pokemon.com/ https://www.pokemon.com/ https://www.pokemon.com/
Server
4. Meaningful Presentation3. Static Content Render2. Blank Screen1. Blank Screen
Overview - Server Side Rendering
<html lang="en">
<head>
<link href="/style.css" rel="stylesheet"/>
</head>
<body>
<div id="root">
<div class="root-component">
<h1 class="title"> React Meetup </h1>
</div>
</div>
<script src="/index.js" type="text/javascript"></script>
</body>
</html>
- Server(NodeJs) renders the App and generates the content
at server-side and returns the generated content.
Request Overview
https://www.pokemon.com/
21
https://www.pokemon.com/
GET /
● Server get
request
● Server gets
pokemon from DB
● Server renders
HTML
Downloads js and Renders DOM
- DOM Renders again
on client-side.
- Verify state and
attach handlers
CSR - Lighthouse Report
SSR - Lighthouse Report
CSR - Performance Report
SSR - Performance Report
“A good discussion increases the
dimensions of everyone who takes part”
- From Randolph Bourne
Have a great Day!
Ad

More Related Content

What's hot (20)

AngularJS introduction
AngularJS introductionAngularJS introduction
AngularJS introduction
Tania Gonzales
 
Angular js
Angular jsAngular js
Angular js
Dinusha Nandika
 
AngularJS application architecture
AngularJS application architectureAngularJS application architecture
AngularJS application architecture
Gabriele Falace
 
The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014
Matt Raible
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
Nikolaus Graf
 
AngularJS Deep Dives (NYC GDG Apr 2013)
AngularJS Deep Dives (NYC GDG Apr 2013)AngularJS Deep Dives (NYC GDG Apr 2013)
AngularJS Deep Dives (NYC GDG Apr 2013)
Nitya Narasimhan
 
AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)
Gary Arora
 
Angular js for beginners
Angular js for beginnersAngular js for beginners
Angular js for beginners
Munir Hoque
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get startedAngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
Stéphane Bégaudeau
 
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
Binary Studio
 
AngularJS Basic Training
AngularJS Basic TrainingAngularJS Basic Training
AngularJS Basic Training
Cornel Stefanache
 
ReactJs presentation
ReactJs presentationReactJs presentation
ReactJs presentation
nishasowdri
 
React JS part 1
React JS part 1React JS part 1
React JS part 1
Diluka Wittahachchige
 
AngularJS: an introduction
AngularJS: an introductionAngularJS: an introduction
AngularJS: an introduction
Luigi De Russis
 
The AngularJS way
The AngularJS wayThe AngularJS way
The AngularJS way
Boyan Mihaylov
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
Aayush Shrestha
 
React / Redux Architectures
React / Redux ArchitecturesReact / Redux Architectures
React / Redux Architectures
Vinícius Ribeiro
 
Understanding angular js $rootscope and $scope
Understanding angular js $rootscope and $scopeUnderstanding angular js $rootscope and $scope
Understanding angular js $rootscope and $scope
Brajesh Yadav
 
ReactJS for Beginners
ReactJS for BeginnersReactJS for Beginners
ReactJS for Beginners
Oswald Campesato
 
Angularjs architecture
Angularjs architectureAngularjs architecture
Angularjs architecture
Michael He
 
AngularJS introduction
AngularJS introductionAngularJS introduction
AngularJS introduction
Tania Gonzales
 
AngularJS application architecture
AngularJS application architectureAngularJS application architecture
AngularJS application architecture
Gabriele Falace
 
The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014
Matt Raible
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
Nikolaus Graf
 
AngularJS Deep Dives (NYC GDG Apr 2013)
AngularJS Deep Dives (NYC GDG Apr 2013)AngularJS Deep Dives (NYC GDG Apr 2013)
AngularJS Deep Dives (NYC GDG Apr 2013)
Nitya Narasimhan
 
AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)
Gary Arora
 
Angular js for beginners
Angular js for beginnersAngular js for beginners
Angular js for beginners
Munir Hoque
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get startedAngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
Stéphane Bégaudeau
 
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
Binary Studio
 
ReactJs presentation
ReactJs presentationReactJs presentation
ReactJs presentation
nishasowdri
 
AngularJS: an introduction
AngularJS: an introductionAngularJS: an introduction
AngularJS: an introduction
Luigi De Russis
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
Aayush Shrestha
 
Understanding angular js $rootscope and $scope
Understanding angular js $rootscope and $scopeUnderstanding angular js $rootscope and $scope
Understanding angular js $rootscope and $scope
Brajesh Yadav
 
Angularjs architecture
Angularjs architectureAngularjs architecture
Angularjs architecture
Michael He
 

Similar to Let's react - Meetup (20)

ReactJS
ReactJSReactJS
ReactJS
Ram Murat Sharma
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
Nitin Tyagi
 
Server side rendering with React and Symfony
Server side rendering with React and SymfonyServer side rendering with React and Symfony
Server side rendering with React and Symfony
Ignacio Martín
 
React & Redux for noobs
React & Redux for noobsReact & Redux for noobs
React & Redux for noobs
[T]echdencias
 
Materi Modern React Redux Power Point.pdf
Materi Modern React Redux Power Point.pdfMateri Modern React Redux Power Point.pdf
Materi Modern React Redux Power Point.pdf
exiabreak
 
Course CodeSchool - Shaping up with Angular.js
Course CodeSchool - Shaping up with Angular.jsCourse CodeSchool - Shaping up with Angular.js
Course CodeSchool - Shaping up with Angular.js
Vinícius de Moraes
 
React js
React jsReact js
React js
Rajesh Kolla
 
243329387 angular-docs
243329387 angular-docs243329387 angular-docs
243329387 angular-docs
Abhi166803
 
Component level caching with react
Component level caching with reactComponent level caching with react
Component level caching with react
AnusheelSingh2
 
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017
Elyse Kolker Gordon
 
React for Re-use: Creating UI Components with Confluence Connect
React for Re-use: Creating UI Components with Confluence ConnectReact for Re-use: Creating UI Components with Confluence Connect
React for Re-use: Creating UI Components with Confluence Connect
Atlassian
 
A full introductory guide to React
A full introductory guide to ReactA full introductory guide to React
A full introductory guide to React
Jean Carlo Emer
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
Eliran Eliassy
 
React
React React
React
중운 박
 
Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...
Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...
Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...
Luciano Mammino
 
Introduction to react and redux
Introduction to react and reduxIntroduction to react and redux
Introduction to react and redux
Cuong Ho
 
Os Haase
Os HaaseOs Haase
Os Haase
oscon2007
 
React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix
Chen Lerner
 
Intro react js
Intro react jsIntro react js
Intro react js
Vijayakanth MP
 
React on Rails - RailsConf 2017 (Phoenix)
 React on Rails - RailsConf 2017 (Phoenix) React on Rails - RailsConf 2017 (Phoenix)
React on Rails - RailsConf 2017 (Phoenix)
Jo Cranford
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
Nitin Tyagi
 
Server side rendering with React and Symfony
Server side rendering with React and SymfonyServer side rendering with React and Symfony
Server side rendering with React and Symfony
Ignacio Martín
 
React & Redux for noobs
React & Redux for noobsReact & Redux for noobs
React & Redux for noobs
[T]echdencias
 
Materi Modern React Redux Power Point.pdf
Materi Modern React Redux Power Point.pdfMateri Modern React Redux Power Point.pdf
Materi Modern React Redux Power Point.pdf
exiabreak
 
Course CodeSchool - Shaping up with Angular.js
Course CodeSchool - Shaping up with Angular.jsCourse CodeSchool - Shaping up with Angular.js
Course CodeSchool - Shaping up with Angular.js
Vinícius de Moraes
 
243329387 angular-docs
243329387 angular-docs243329387 angular-docs
243329387 angular-docs
Abhi166803
 
Component level caching with react
Component level caching with reactComponent level caching with react
Component level caching with react
AnusheelSingh2
 
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017
Elyse Kolker Gordon
 
React for Re-use: Creating UI Components with Confluence Connect
React for Re-use: Creating UI Components with Confluence ConnectReact for Re-use: Creating UI Components with Confluence Connect
React for Re-use: Creating UI Components with Confluence Connect
Atlassian
 
A full introductory guide to React
A full introductory guide to ReactA full introductory guide to React
A full introductory guide to React
Jean Carlo Emer
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
Eliran Eliassy
 
Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...
Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...
Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...
Luciano Mammino
 
Introduction to react and redux
Introduction to react and reduxIntroduction to react and redux
Introduction to react and redux
Cuong Ho
 
React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix
Chen Lerner
 
React on Rails - RailsConf 2017 (Phoenix)
 React on Rails - RailsConf 2017 (Phoenix) React on Rails - RailsConf 2017 (Phoenix)
React on Rails - RailsConf 2017 (Phoenix)
Jo Cranford
 
Ad

Recently uploaded (20)

#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Ad

Let's react - Meetup

  • 1. Let’s React By Rajnish Katharotiya Front-end Engineer @knovator
  • 2. Topics ➔ Introduction of ReactJS. ➔ Component workflow. ➔ State management and useful life-cycles. ➔ React hooks. ➔ Server Side Rendering.
  • 3. React Introduction - React is an javascript library for building user interface. ✅ Following 👆 ✅ Following
  • 4. React Introduction - Initialise app. npx create-react-app my-app //cra boilerplate cd my-app npm start
  • 5. React Introduction - Render app into Actual DOM. ReactDOM.render( <APP />, document.getElementById('root') ) <!DOCTYPE Html> <html> <head>...</head> <body> <div id="root" /> </body> </html> /public/index.html /src/index.js Compiled JSX syntax
  • 6. What is JSX ?? JSX is basically a syntax extension of regular JavaScript and is used to create React elements. These elements are then rendered to the React DOM. import React from 'react'; const App = () => ( <h1>Hello</h1> ); export default App; /app.js
  • 7. Components class Profile extends Component { state = { followBtnText: 'Following' }; render() { const { state } = this; return ( <Button {...state} /> ); } } /Profile.js - class const Button = ({followBtnText}) => { return ( <button> {followBtnText} </button> ); }; /Button.js - functional
  • 8. What is state? In the React sense, “state” is an object that represents the parts of the app that can change. Each component can maintain its own state, which lives in an object called this. state class Profile extends Component { constructor(props){ super(props); state = { followBtnText : “Follow” }; } componentDidMount(){ this.setState({ followBtnText: “Following” }) } render() { const { state } = this; return ( <Button {...state} /> ); } } /Profile.js
  • 9. What is Props ? class Profile extends Component { constructor(props){ super(props); state = { userName : 'John Doe' }; } componentDidMount(){ this.setState({ ...this.props }) } render() { const { state } = this; return ( <Name {...state} /> ); // return ( <Name userName={state.userName} /> ) } /Profile.js const Name = (props) => { const { userName } = props; return ( <h1>{userName}</h1> ); }; /Name.js
  • 11. - Global State management - Store - Actions - Reducers Redux
  • 12. Lifecycles - Each Component has lifecycle which you can monitor and manipulate during its phases.
  • 13. Useful Lifecycles ➔ componentWillMount() ➔ render() ➔ componentDidMount() ➔ componentWillReceiveProps() / componentDidUpdate() ➔ shouldComponentUpdate() ➔ componentWillUnmount()
  • 14. React Hook - Function to hook with state and Lifecycle of functional component. const Profile = () => { const [ followStatus, setFollowStatus ] = useState(‘Follow’); return ( <Button followStatus={followStatus} /> ); } /Profile.js
  • 15. React Hook - On Mount const TopPicks = (props) => { const [ list, setList ] = useState([]); useEffect( () => { const list = getTopPicksByUser(); setList(list); }, [] ); return ( <Videos list={list} /> ); } /TopPicks.js
  • 16. React Hook - On Update const VideoItem = (props) => { const [ progress, setProgress ] = useState(‘’); useEffect( () => { setProgress( props.progress ); }, [ props.progress ] ); return ( <ProgressBar progress={progress} /> ); } /VideoItem.js
  • 17. React Hook - On Unmount const UserStatus = (props) => { const [ staus, setStatus ] = useState(‘Active’); useEffect( () => { getUserStatus.subscribe(setStatus); return () => getUserStatus.unsubscribe(setStatus); }, [] ); return status; } /app.js
  • 18. Server Side Rendering - SSR is the ability of a front-end framework to render markup while running on a back-end system. ➔ Performance benefit for our customer. ➔ Faster time for an initial page render. ➔ Consistent SEO performance. Why SSR?
  • 19. Overview - Client Side Rendering - Browser download the javascript and then use it to execute content. <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> <link href="/style.css" rel="stylesheet"/> <title>Knovator</title> <link rel="icon" href="/favicon.png" type="image/gif" sizes="16x16"> </head> <body> <div id="root"></div> <script src="/index.js" type="text/javascript"></script> <script src="/vendor.js" type="text/javascript"></script> </body> </html>
  • 21. Pokemon - Get #1 Browser Server <html lang="en"> <head> <link href="/style.css" rel="stylesheet"/> </head> <body> <div id="root"></div> <script src="/index.js" type="text/javascript"></script> </body> </html> GET / index.html
  • 22. Pokemon - View #1 https://www.pokemon.com/
  • 23. Pokemon - Get #2 Browser Server GET /index.js index.js
  • 24. Pokemon - View #2 https://www.pokemon.com/ - Thousands lines of javascript code prased. - Script execution begin. - ReactDOM render.
  • 25. Pokemon - Get #3 Browser Pokemon Server GET /api/pokemon Pokemon https://www.pokemon.com/
  • 26. Request Overview https://www.pokemon.com/ https://www.pokemon.com/ https://www.pokemon.com/ https://www.pokemon.com/ Server 4. Meaningful Presentation3. Static Content Render2. Blank Screen1. Blank Screen
  • 27. Overview - Server Side Rendering <html lang="en"> <head> <link href="/style.css" rel="stylesheet"/> </head> <body> <div id="root"> <div class="root-component"> <h1 class="title"> React Meetup </h1> </div> </div> <script src="/index.js" type="text/javascript"></script> </body> </html> - Server(NodeJs) renders the App and generates the content at server-side and returns the generated content.
  • 28. Request Overview https://www.pokemon.com/ 21 https://www.pokemon.com/ GET / ● Server get request ● Server gets pokemon from DB ● Server renders HTML Downloads js and Renders DOM - DOM Renders again on client-side. - Verify state and attach handlers
  • 33. “A good discussion increases the dimensions of everyone who takes part” - From Randolph Bourne
  • 34. Have a great Day!

Editor's Notes

  • #2: Hey everybody, Today we will talk about few concepts of React. In this meet-up, i would like to discuss topics of beginner to expert level. So, before going further let me introduce mysef, i’m rajnish katharotiya working here at knovator as an front-end engineer. And has been developing react applications from past 1.5 years. In my one and half year of journy i learnt many stuffs about react implementations and best practices. So, let’s just dive into topic which we are gonna cover and discuss together in this meetup.
  • #3: This top five topics i picked to discuss, where first one is introduction of reactjs, component workflow to get basic idea of react, some of us is totally new to react so this will help them to get understand why we should using it and what is it advantages. Then next state management and useful life-cycles is there, who's already started react for them this can be best practices. This all topics needed to become reactjs developer. While moving further we have next booming topic called React Hooks, this one is launched few months ago from 16.8v of react with some exciting features. And finally more attractive topic of all comes in line is Server Side Rendering aka SSR which also one of necessary tech which beneficial to know with react. Now let’s see all one by one ….
  • #4: So, FIrst React is a javascript library which use to build a user interface of the web app. The main advantage of this platform is to update UI changes through Virtual DOM. Here is one example of it. ……. In old days, when we wanted to update a status of just the number of comments of a particular page user has to reload whole DOM by refreshing page. Whereas with the help of this virtual DOM, it will update just only text of button-like follow to following. With no time, it’ll update our viewport without re-rendering actual DOM.
  • #5: React is a javascript library which use to build a user interface of the web app. The main advantage of this platform is to update UI changes through Virtual DOM. Here is one example of it. ……. In old days, when we wanted to update a status of just the number of comments of a particular page user has to reload whole DOM by refreshing page. While the help of this virtual DOM, it will update just only text of button-like follow to following. With no time, it’ll update our viewport without re-rendering actual DOM.
  • #6: React is a javascript library which use to build a user interface of the web app. The main advantage of this platform is to update UI changes through Virtual DOM. Here is one example of it. ……. In old days, when we wanted to update a status of just the number of comments of a particular page user has to reload whole DOM by refreshing page. While the help of this virtual DOM, it will update just only text of button-like follow to following. With no time, it’ll update our viewport without re-rendering actual DOM.