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!

More Related Content

What's hot

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
 

What's hot (20)

AngularJS introduction
AngularJS introductionAngularJS introduction
AngularJS introduction
 
Angular js
Angular jsAngular js
Angular js
 
AngularJS application architecture
AngularJS application architectureAngularJS application architecture
AngularJS application architecture
 
The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
 
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)
 
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)
 
Angular js for beginners
Angular js for beginnersAngular js for beginners
Angular js for beginners
 
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
 
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)
 
AngularJS Basic Training
AngularJS Basic TrainingAngularJS Basic Training
AngularJS Basic Training
 
ReactJs presentation
ReactJs presentationReactJs presentation
ReactJs presentation
 
React JS part 1
React JS part 1React JS part 1
React JS part 1
 
AngularJS: an introduction
AngularJS: an introductionAngularJS: an introduction
AngularJS: an introduction
 
The AngularJS way
The AngularJS wayThe AngularJS way
The AngularJS way
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
 
React / Redux Architectures
React / Redux ArchitecturesReact / Redux Architectures
React / Redux Architectures
 
Understanding angular js $rootscope and $scope
Understanding angular js $rootscope and $scopeUnderstanding angular js $rootscope and $scope
Understanding angular js $rootscope and $scope
 
ReactJS for Beginners
ReactJS for BeginnersReactJS for Beginners
ReactJS for Beginners
 
Angularjs architecture
Angularjs architectureAngularjs architecture
Angularjs architecture
 

Similar to Let's react - Meetup

ReactJS
ReactJSReactJS
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
 
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
 
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
 
React outbox
React outboxReact outbox
React outbox
Angela Lehru
 

Similar to Let's react - Meetup (20)

ReactJS
ReactJSReactJS
ReactJS
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
 
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
 
React & Redux for noobs
React & Redux for noobsReact & Redux for noobs
React & Redux for noobs
 
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
 
React js
React jsReact js
React js
 
243329387 angular-docs
243329387 angular-docs243329387 angular-docs
243329387 angular-docs
 
Component level caching with react
Component level caching with reactComponent level caching with react
Component level caching with react
 
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
 
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
 
A full introductory guide to React
A full introductory guide to ReactA full introductory guide to React
A full introductory guide to React
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
 
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...
 
Introduction to react and redux
Introduction to react and reduxIntroduction to react and redux
Introduction to react and redux
 
Os Haase
Os HaaseOs Haase
Os Haase
 
React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix
 
Intro react js
Intro react jsIntro react js
Intro react js
 
React on Rails - RailsConf 2017 (Phoenix)
 React on Rails - RailsConf 2017 (Phoenix) React on Rails - RailsConf 2017 (Phoenix)
React on Rails - RailsConf 2017 (Phoenix)
 
React outbox
React outboxReact outbox
React outbox
 

Recently uploaded

FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 

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

  1. 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.
  2. 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 ….
  3. 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.
  4. 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.
  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.