SlideShare a Scribd company logo
React JS: A Secret Preview
Prashant Sharma
https://www.linkedin.com/in/response2prashant
Agendas
1. Introduction
2. What is React JS?
3. What is Single Page Application?
4. Why React is better than other SPA?
5. React JS Setup
6. React JSX
7. ES6 Arrow Function
8. React Components
9. Component Life Cycle
10. Error Boundaries
11. React Higher Order Component (hoc)
12. Axios in React
to be continued….
12. Redux
13. Advantages of React JS
14. Disadvantages of React JS
● React is a front-end library developed by Facebook, in the year 2013.
● It is used for handling the view layer for web and mobile apps.
● ReactJS allows us to create reusable UI components.
● It is currently one of the most popular JavaScript libraries and has a
strong foundation and large community behind it.
Introduction
● React is a library for building composable user interfaces.
● It encourages the creation of reusable UI components, which present
data that changes over time.
● React abstracts away the DOM from you, offering a simpler
programming model and better performance.
● React can also render on the server using Node, and it can power
native apps using React Native.
● React implements one-way reactive data flow, which reduces the
boilerplate and is easier to reason about than traditional data binding.
What is React JS ?
What is Single Page Applications?
A single-page application is an app that works inside a browser and does
not require page reloading during use.
You are using this type of applications every day. These are for instance:
Gmail, Google Maps, Facebook and GitHub.
● There are various Single Page Applications Frameworks like Angularjs,
Reactjs and Vuejs.
● Angularjs is a MVC framework . Angularjs is complicated in comparison
to Reactjs and Vuejs but proper documentation available.
● Reactjs is a library not a framework and easy to learn but proper
documentation is not available.
Why React is better than other
SPAs?
...to be continue
● High level of flexibility and maximum of responsiveness.
● Vue js describes itself as “The Progressive JavaScript Frameworks”
and easy to learn in comparison to Angularjs and Reactjs.
● Lack of full english documentation.
● Vue js might have issues while integrating into huge projects.
Step: 1
Install node in your system
Step: 2
Open terminal type npm init react-app my-app
Step: 3
type cd my-app
Step: 4
type npm start
Step: 5
Now you can start building react app.
React configuration
React JSX
React uses JSX for templating instead of regular JavaScript. It is not
necessary to use it, however, following are some pros that come with it.
1. It is faster because it performs optimization while compiling code to
JavaScript.
2. It is also type-safe and most of the errors can be caught during
compilation.
3. It makes it easier and faster to write templates, if you are familiar with
HTML.
...to be continued
import React, {Component} from 'react';
import Layout from './components/Layout/Layout.js';
import BurgerBuilder from './containers/BurgerBuilder/BurgerBuilder';
import { BrowserRouter, Route, link} from 'react-router-dom';
class App extends Component {
render() {
return (
<div>
<BrowserRouter>
<Layout>
<Route path="/" exact component={BurgerBuilder} />
</Layout>
</BrowserRouter>
</div>
);
}
}
export default App;
ES6 Arrow Function
arrowfunctionExample = () => {
return(
<div>Something</div>
);
}
Arrow function single parameter syntax:
arrowfunctionExample = a => a*a;
Arrow function double parameter syntax:
arrowfunctionExample = (a,b) => a*b;
Arrow function with JSX:
arrowfunctionExample = () => (<div>Something</div>);
….to be continued
Arrow function with multiple line:
arrowfunctionExample = (a, b) =>{
const c = a+b;
return (
<div>Something {c}</div>
);
}
React Components
There are basically two types of component are used:
1. Stateful component
2. Stateless component
...to be continued
Stateful components:
import Backdrop from ‘backdrop’;
class Person extends Component {
state={
count: 0
}
render(){
return(
<div>
{this.state.count
<Backdrop show=”true” />
</div>);
}
}
export default Person:
...to be continued
Stateless components:
Stateless components have not their own state always dependant upon
another component. These components are reusable components.
const backdrop = (props) => (
props.show
?<div className={classes.Backdrop} onClick={props.clicked}></div>
: null
);
React Component Lifecycle
● We need more control over the stages that a component goes
through.
● The process where all these stages are involved is called the
component’s lifecycle and every React component goes through it.
● React provides several methods that notify us when certain stage of
this process occurs.
● These methods are called the component’s lifecycle methods and
they are invoked in a predictable order.
...to be continued
Basically all the React component’s lifecyle methods can be split in four
phases: initialization, mounting, updating and unmounting. Let’s take a
closer look at each one of them.
Initialization
The initialization phase is where we define defaults and initial values for
this.props and this.state by implementing getDefaultProps() and
getInitialState() respectively.
...to be continued
Mounting
Mounting is the process that occurs when a component is being inserted
into the DOM. This phase has two methods that we can hook up with:
componentWillMount() and componentDidMount().
componentWillMount() method is first called in this phase.
componentDidMount() is invoked second in this phase.
...to be continued
Updating
There are also methods that will allow us to execute code relative to when
a component’s state or properties get updated. These methods are part of
the updating phase and are called in the following order:
componentWillReceiveProps()
shouldComponentUpdate()
componentWillUpdate()
render()
componentDidUpdate()
When received new
props from the parent.
...to be continued
Unmounting
In this phase React provide us with only one method:
● componentWillUnmount()
It is called immediately before the component is unmounted
from the DOM.
Error Boundaries
● A JavaScript error in a part of the UI shouldn’t break the whole app.
● To solve this problem for React users, React 16 introduces a new
concept of an “error boundary”.
● Error boundaries are React components that catch JavaScript errors
anywhere in their child component tree, log those errors, and display a
fallback UI instead of the component tree that crashed.
● Error boundaries catch errors during rendering, in lifecycle methods,
and in constructors of the whole tree below them.
...to be continued
class ErroBoundary extends React.Component{
state= {
hasError: false
}
componentDidCatch(error, info){
//Display fallback, UI
this,setState({hasError:true});
// You can also log error to an error reporting service
logErrorToMyService(error, info);
}
render(){
if(this.state.hasError){
return (<div>Something went wrong</div>);
}
return this.props.children;
}
}
...to be continued
Then you can use it as a regular component
<ErrorBoundary>
<MyComponent />
</ErrorBoundary>
React Higher Order Component
● A higher-order component in React is a pattern used to share common
functionality between components without repeating code.
● A higher-order component is actually not a component though, it is a
function.
● A HOC function takes a component as an argument and returns a
component.
● It transforms a component into another component and adds
additional data or functionality.
...to be continued
const NewComponent = (BaseComponent) => {
// ... create new component from old one and update
return UpdatedComponent
}
Axios in React
● Every project needs to interact with a REST API at some stage.
● Axios provides interaction with REST API.
● With the help of AXIOS you can send GET, POST, PUT and DELETE
request to the REST API and render response to our app.
● Axios is promise based.
What is Redux?
Redux is a predictable state container for JavaScript apps. Redux
uses this concept of uni-directional data flow:
● The application has a central /root state.
● A state change triggers View updates.
● Only special functions can change the state.
● A user interaction triggers these special, state changing functions.
● Only one change takes place at a time.
...to be continued
Advantages of React JS
1. Virtual DOM in ReactJS makes user experience better and
developer’s work faster.
2. Permission to reuse React components significantly saves time.
3. One-direction data flow in ReactJS provides a stable code.
4. An open-source library: constantly developing and open to
contributions.
Disadvantages of React
1. High pace of development.
2. Poor documentation.
3. ‘HTML in my JavaScript!’ – JSX as a barrier.
Thank you

More Related Content

What's hot

ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
Thanh Tuong
 
Introduction to React JS for beginners | Namespace IT
Introduction to React JS for beginners | Namespace ITIntroduction to React JS for beginners | Namespace IT
Introduction to React JS for beginners | Namespace IT
namespaceit
 
Redux workshop
Redux workshopRedux workshop
Redux workshop
Imran Sayed
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
Nikolaus Graf
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
Rob Quick
 
React js
React jsReact js
React js
Alireza Akbari
 
React js
React jsReact js
React js
Rajesh Kolla
 
React js - The Core Concepts
React js - The Core ConceptsReact js - The Core Concepts
React js - The Core Concepts
Divyang Bhambhani
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
Bethmi Gunasekara
 
React js for beginners
React js for beginnersReact js for beginners
React js for beginners
Alessandro Valenti
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.js
Emanuele DelBono
 
ReactJS
ReactJSReactJS
Introduction to Redux
Introduction to ReduxIntroduction to Redux
Introduction to Redux
Ignacio Martín
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
GDSC UofT Mississauga
 
learn what React JS is & why we should use React JS .
learn what React JS is & why we should use React JS .learn what React JS is & why we should use React JS .
learn what React JS is & why we should use React JS .
paradisetechsoftsolutions
 
Intro to React
Intro to ReactIntro to React
Intro to React
Justin Reock
 
React and redux
React and reduxReact and redux
React and redux
Mystic Coders, LLC
 
React JS and why it's awesome
React JS and why it's awesomeReact JS and why it's awesome
React JS and why it's awesome
Andrew Hull
 

What's hot (20)

ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
 
React JS - Introduction
React JS - IntroductionReact JS - Introduction
React JS - Introduction
 
Introduction to React JS for beginners | Namespace IT
Introduction to React JS for beginners | Namespace ITIntroduction to React JS for beginners | Namespace IT
Introduction to React JS for beginners | Namespace IT
 
Redux workshop
Redux workshopRedux workshop
Redux workshop
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
 
React js
React jsReact js
React js
 
React js
React jsReact js
React js
 
React js - The Core Concepts
React js - The Core ConceptsReact js - The Core Concepts
React js - The Core Concepts
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
 
React js for beginners
React js for beginnersReact js for beginners
React js for beginners
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.js
 
ReactJS
ReactJSReactJS
ReactJS
 
Introduction to Redux
Introduction to ReduxIntroduction to Redux
Introduction to Redux
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
 
React js
React jsReact js
React js
 
learn what React JS is & why we should use React JS .
learn what React JS is & why we should use React JS .learn what React JS is & why we should use React JS .
learn what React JS is & why we should use React JS .
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
React and redux
React and reduxReact and redux
React and redux
 
React JS and why it's awesome
React JS and why it's awesomeReact JS and why it's awesome
React JS and why it's awesome
 

Similar to React JS: A Secret Preview

Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react js
StephieJohn
 
Tech Talk on ReactJS
Tech Talk on ReactJSTech Talk on ReactJS
Tech Talk on ReactJS
Atlogys Technical Consulting
 
class based component.pptx
class based component.pptxclass based component.pptx
class based component.pptx
saikatsamanta49
 
What are the components in React?
What are the components in React?What are the components in React?
What are the components in React?
BOSC Tech Labs
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
Nitin Tyagi
 
React gsg presentation with ryan jung &amp; elias malik
React   gsg presentation with ryan jung &amp; elias malikReact   gsg presentation with ryan jung &amp; elias malik
React gsg presentation with ryan jung &amp; elias malik
Lama K Banna
 
Fundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdfFundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdf
StephieJohn
 
Welcome to React & Flux !
Welcome to React & Flux !Welcome to React & Flux !
Welcome to React & Flux !Ritesh Kumar
 
React Basic and Advance || React Basic
React Basic and Advance   || React BasicReact Basic and Advance   || React Basic
React Basic and Advance || React Basic
rafaqathussainc077
 
Comparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAsComparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAs
Jennifer Estrada
 
React JS Interview Question & Answer
React JS Interview Question & AnswerReact JS Interview Question & Answer
React JS Interview Question & Answer
Mildain Solutions
 
React JS .NET
React JS .NETReact JS .NET
React JS .NET
Jennifer Estrada
 
Introduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptxIntroduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptx
SHAIKIRFAN715544
 
FRONTEND DEVELOPMENT WITH REACT.JS
FRONTEND DEVELOPMENT WITH REACT.JSFRONTEND DEVELOPMENT WITH REACT.JS
FRONTEND DEVELOPMENT WITH REACT.JS
IRJET Journal
 
Copy of React_JS_Notes.pdf
Copy of React_JS_Notes.pdfCopy of React_JS_Notes.pdf
Copy of React_JS_Notes.pdf
suryanarayana272799
 
Introduction to React JS.pptx
Introduction to React JS.pptxIntroduction to React JS.pptx
Introduction to React JS.pptx
SHAIKIRFAN715544
 
Build web apps with react js
Build web apps with react jsBuild web apps with react js
Build web apps with react js
dhanushkacnd
 
React Hooks Best Practices in 2022.pptx
React Hooks Best Practices in 2022.pptxReact Hooks Best Practices in 2022.pptx
React Hooks Best Practices in 2022.pptx
BOSC Tech Labs
 

Similar to React JS: A Secret Preview (20)

Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react js
 
Intro react js
Intro react jsIntro react js
Intro react js
 
Tech Talk on ReactJS
Tech Talk on ReactJSTech Talk on ReactJS
Tech Talk on ReactJS
 
class based component.pptx
class based component.pptxclass based component.pptx
class based component.pptx
 
What are the components in React?
What are the components in React?What are the components in React?
What are the components in React?
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
 
React gsg presentation with ryan jung &amp; elias malik
React   gsg presentation with ryan jung &amp; elias malikReact   gsg presentation with ryan jung &amp; elias malik
React gsg presentation with ryan jung &amp; elias malik
 
Presentation1
Presentation1Presentation1
Presentation1
 
Fundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdfFundamental Concepts of React JS for Beginners.pdf
Fundamental Concepts of React JS for Beginners.pdf
 
Welcome to React & Flux !
Welcome to React & Flux !Welcome to React & Flux !
Welcome to React & Flux !
 
React Basic and Advance || React Basic
React Basic and Advance   || React BasicReact Basic and Advance   || React Basic
React Basic and Advance || React Basic
 
Comparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAsComparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAs
 
React JS Interview Question & Answer
React JS Interview Question & AnswerReact JS Interview Question & Answer
React JS Interview Question & Answer
 
React JS .NET
React JS .NETReact JS .NET
React JS .NET
 
Introduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptxIntroduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptx
 
FRONTEND DEVELOPMENT WITH REACT.JS
FRONTEND DEVELOPMENT WITH REACT.JSFRONTEND DEVELOPMENT WITH REACT.JS
FRONTEND DEVELOPMENT WITH REACT.JS
 
Copy of React_JS_Notes.pdf
Copy of React_JS_Notes.pdfCopy of React_JS_Notes.pdf
Copy of React_JS_Notes.pdf
 
Introduction to React JS.pptx
Introduction to React JS.pptxIntroduction to React JS.pptx
Introduction to React JS.pptx
 
Build web apps with react js
Build web apps with react jsBuild web apps with react js
Build web apps with react js
 
React Hooks Best Practices in 2022.pptx
React Hooks Best Practices in 2022.pptxReact Hooks Best Practices in 2022.pptx
React Hooks Best Practices in 2022.pptx
 

More from valuebound

Scaling Drupal for High Traffic Websites
Scaling Drupal for High Traffic WebsitesScaling Drupal for High Traffic Websites
Scaling Drupal for High Traffic Websites
valuebound
 
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdfDrupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
valuebound
 
How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.
valuebound
 
How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound
valuebound
 
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
How to Use Firebase to Send Push Notifications to React Native and Node.js AppsHow to Use Firebase to Send Push Notifications to React Native and Node.js Apps
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
valuebound
 
Mastering Drupal Theming
Mastering Drupal ThemingMastering Drupal Theming
Mastering Drupal Theming
valuebound
 
The Benefits of Cloud Engineering
The Benefits of Cloud EngineeringThe Benefits of Cloud Engineering
The Benefits of Cloud Engineering
valuebound
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
valuebound
 
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
valuebound
 
Deep dive into ChatGPT
Deep dive into ChatGPTDeep dive into ChatGPT
Deep dive into ChatGPT
valuebound
 
Content Creation Solution | Valuebound
Content Creation Solution | ValueboundContent Creation Solution | Valuebound
Content Creation Solution | Valuebound
valuebound
 
Road ahead for Drupal 8 contributed projects
Road ahead for Drupal 8 contributed projectsRoad ahead for Drupal 8 contributed projects
Road ahead for Drupal 8 contributed projects
valuebound
 
Chatbot with RASA | Valuebound
Chatbot with RASA | ValueboundChatbot with RASA | Valuebound
Chatbot with RASA | Valuebound
valuebound
 
Drupal and Artificial Intelligence for Personalization
Drupal and Artificial Intelligence for Personalization Drupal and Artificial Intelligence for Personalization
Drupal and Artificial Intelligence for Personalization
valuebound
 
Drupal growth in last year | Valuebound
Drupal growth in last year | ValueboundDrupal growth in last year | Valuebound
Drupal growth in last year | Valuebound
valuebound
 
BE NEW TO THE WORLD "BRAVE FROM CHROME"
BE NEW TO THE WORLD "BRAVE FROM CHROME"BE NEW TO THE WORLD "BRAVE FROM CHROME"
BE NEW TO THE WORLD "BRAVE FROM CHROME"
valuebound
 
Event loop in browser
Event loop in browserEvent loop in browser
Event loop in browser
valuebound
 
The Basics of MongoDB
The Basics of MongoDBThe Basics of MongoDB
The Basics of MongoDB
valuebound
 
Dependency Injection in Drupal 8
Dependency Injection in Drupal 8Dependency Injection in Drupal 8
Dependency Injection in Drupal 8
valuebound
 
An Overview of Field Collection Views Module
An Overview of Field Collection Views ModuleAn Overview of Field Collection Views Module
An Overview of Field Collection Views Module
valuebound
 

More from valuebound (20)

Scaling Drupal for High Traffic Websites
Scaling Drupal for High Traffic WebsitesScaling Drupal for High Traffic Websites
Scaling Drupal for High Traffic Websites
 
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdfDrupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
 
How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.
 
How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound
 
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
How to Use Firebase to Send Push Notifications to React Native and Node.js AppsHow to Use Firebase to Send Push Notifications to React Native and Node.js Apps
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
 
Mastering Drupal Theming
Mastering Drupal ThemingMastering Drupal Theming
Mastering Drupal Theming
 
The Benefits of Cloud Engineering
The Benefits of Cloud EngineeringThe Benefits of Cloud Engineering
The Benefits of Cloud Engineering
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
 
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
 
Deep dive into ChatGPT
Deep dive into ChatGPTDeep dive into ChatGPT
Deep dive into ChatGPT
 
Content Creation Solution | Valuebound
Content Creation Solution | ValueboundContent Creation Solution | Valuebound
Content Creation Solution | Valuebound
 
Road ahead for Drupal 8 contributed projects
Road ahead for Drupal 8 contributed projectsRoad ahead for Drupal 8 contributed projects
Road ahead for Drupal 8 contributed projects
 
Chatbot with RASA | Valuebound
Chatbot with RASA | ValueboundChatbot with RASA | Valuebound
Chatbot with RASA | Valuebound
 
Drupal and Artificial Intelligence for Personalization
Drupal and Artificial Intelligence for Personalization Drupal and Artificial Intelligence for Personalization
Drupal and Artificial Intelligence for Personalization
 
Drupal growth in last year | Valuebound
Drupal growth in last year | ValueboundDrupal growth in last year | Valuebound
Drupal growth in last year | Valuebound
 
BE NEW TO THE WORLD "BRAVE FROM CHROME"
BE NEW TO THE WORLD "BRAVE FROM CHROME"BE NEW TO THE WORLD "BRAVE FROM CHROME"
BE NEW TO THE WORLD "BRAVE FROM CHROME"
 
Event loop in browser
Event loop in browserEvent loop in browser
Event loop in browser
 
The Basics of MongoDB
The Basics of MongoDBThe Basics of MongoDB
The Basics of MongoDB
 
Dependency Injection in Drupal 8
Dependency Injection in Drupal 8Dependency Injection in Drupal 8
Dependency Injection in Drupal 8
 
An Overview of Field Collection Views Module
An Overview of Field Collection Views ModuleAn Overview of Field Collection Views Module
An Overview of Field Collection Views Module
 

Recently uploaded

GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
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
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
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
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
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
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
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
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
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
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
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
 
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
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
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
 

Recently uploaded (20)

GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
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*
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
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
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
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...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
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
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
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
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
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
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
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
 

React JS: A Secret Preview

  • 1. React JS: A Secret Preview Prashant Sharma https://www.linkedin.com/in/response2prashant
  • 2. Agendas 1. Introduction 2. What is React JS? 3. What is Single Page Application? 4. Why React is better than other SPA? 5. React JS Setup 6. React JSX 7. ES6 Arrow Function 8. React Components 9. Component Life Cycle 10. Error Boundaries 11. React Higher Order Component (hoc) 12. Axios in React
  • 3. to be continued…. 12. Redux 13. Advantages of React JS 14. Disadvantages of React JS
  • 4. ● React is a front-end library developed by Facebook, in the year 2013. ● It is used for handling the view layer for web and mobile apps. ● ReactJS allows us to create reusable UI components. ● It is currently one of the most popular JavaScript libraries and has a strong foundation and large community behind it. Introduction
  • 5. ● React is a library for building composable user interfaces. ● It encourages the creation of reusable UI components, which present data that changes over time. ● React abstracts away the DOM from you, offering a simpler programming model and better performance. ● React can also render on the server using Node, and it can power native apps using React Native. ● React implements one-way reactive data flow, which reduces the boilerplate and is easier to reason about than traditional data binding. What is React JS ?
  • 6. What is Single Page Applications? A single-page application is an app that works inside a browser and does not require page reloading during use. You are using this type of applications every day. These are for instance: Gmail, Google Maps, Facebook and GitHub.
  • 7. ● There are various Single Page Applications Frameworks like Angularjs, Reactjs and Vuejs. ● Angularjs is a MVC framework . Angularjs is complicated in comparison to Reactjs and Vuejs but proper documentation available. ● Reactjs is a library not a framework and easy to learn but proper documentation is not available. Why React is better than other SPAs?
  • 8. ...to be continue ● High level of flexibility and maximum of responsiveness. ● Vue js describes itself as “The Progressive JavaScript Frameworks” and easy to learn in comparison to Angularjs and Reactjs. ● Lack of full english documentation. ● Vue js might have issues while integrating into huge projects.
  • 9. Step: 1 Install node in your system Step: 2 Open terminal type npm init react-app my-app Step: 3 type cd my-app Step: 4 type npm start Step: 5 Now you can start building react app. React configuration
  • 10. React JSX React uses JSX for templating instead of regular JavaScript. It is not necessary to use it, however, following are some pros that come with it. 1. It is faster because it performs optimization while compiling code to JavaScript. 2. It is also type-safe and most of the errors can be caught during compilation. 3. It makes it easier and faster to write templates, if you are familiar with HTML.
  • 11. ...to be continued import React, {Component} from 'react'; import Layout from './components/Layout/Layout.js'; import BurgerBuilder from './containers/BurgerBuilder/BurgerBuilder'; import { BrowserRouter, Route, link} from 'react-router-dom'; class App extends Component { render() { return ( <div> <BrowserRouter> <Layout> <Route path="/" exact component={BurgerBuilder} /> </Layout> </BrowserRouter> </div> ); } } export default App;
  • 12. ES6 Arrow Function arrowfunctionExample = () => { return( <div>Something</div> ); }
  • 13. Arrow function single parameter syntax: arrowfunctionExample = a => a*a; Arrow function double parameter syntax: arrowfunctionExample = (a,b) => a*b; Arrow function with JSX: arrowfunctionExample = () => (<div>Something</div>);
  • 14. ….to be continued Arrow function with multiple line: arrowfunctionExample = (a, b) =>{ const c = a+b; return ( <div>Something {c}</div> ); }
  • 15. React Components There are basically two types of component are used: 1. Stateful component 2. Stateless component
  • 16. ...to be continued Stateful components: import Backdrop from ‘backdrop’; class Person extends Component { state={ count: 0 } render(){ return( <div> {this.state.count <Backdrop show=”true” /> </div>); } } export default Person:
  • 17. ...to be continued Stateless components: Stateless components have not their own state always dependant upon another component. These components are reusable components. const backdrop = (props) => ( props.show ?<div className={classes.Backdrop} onClick={props.clicked}></div> : null );
  • 18. React Component Lifecycle ● We need more control over the stages that a component goes through. ● The process where all these stages are involved is called the component’s lifecycle and every React component goes through it. ● React provides several methods that notify us when certain stage of this process occurs. ● These methods are called the component’s lifecycle methods and they are invoked in a predictable order.
  • 19. ...to be continued Basically all the React component’s lifecyle methods can be split in four phases: initialization, mounting, updating and unmounting. Let’s take a closer look at each one of them. Initialization The initialization phase is where we define defaults and initial values for this.props and this.state by implementing getDefaultProps() and getInitialState() respectively.
  • 20. ...to be continued Mounting Mounting is the process that occurs when a component is being inserted into the DOM. This phase has two methods that we can hook up with: componentWillMount() and componentDidMount(). componentWillMount() method is first called in this phase. componentDidMount() is invoked second in this phase.
  • 21. ...to be continued Updating There are also methods that will allow us to execute code relative to when a component’s state or properties get updated. These methods are part of the updating phase and are called in the following order: componentWillReceiveProps() shouldComponentUpdate() componentWillUpdate() render() componentDidUpdate() When received new props from the parent.
  • 22. ...to be continued Unmounting In this phase React provide us with only one method: ● componentWillUnmount() It is called immediately before the component is unmounted from the DOM.
  • 23. Error Boundaries ● A JavaScript error in a part of the UI shouldn’t break the whole app. ● To solve this problem for React users, React 16 introduces a new concept of an “error boundary”. ● Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed. ● Error boundaries catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them.
  • 24. ...to be continued class ErroBoundary extends React.Component{ state= { hasError: false } componentDidCatch(error, info){ //Display fallback, UI this,setState({hasError:true}); // You can also log error to an error reporting service logErrorToMyService(error, info); } render(){ if(this.state.hasError){ return (<div>Something went wrong</div>); } return this.props.children; } }
  • 25. ...to be continued Then you can use it as a regular component <ErrorBoundary> <MyComponent /> </ErrorBoundary>
  • 26. React Higher Order Component ● A higher-order component in React is a pattern used to share common functionality between components without repeating code. ● A higher-order component is actually not a component though, it is a function. ● A HOC function takes a component as an argument and returns a component. ● It transforms a component into another component and adds additional data or functionality.
  • 27. ...to be continued const NewComponent = (BaseComponent) => { // ... create new component from old one and update return UpdatedComponent }
  • 28. Axios in React ● Every project needs to interact with a REST API at some stage. ● Axios provides interaction with REST API. ● With the help of AXIOS you can send GET, POST, PUT and DELETE request to the REST API and render response to our app. ● Axios is promise based.
  • 29. What is Redux? Redux is a predictable state container for JavaScript apps. Redux uses this concept of uni-directional data flow: ● The application has a central /root state. ● A state change triggers View updates. ● Only special functions can change the state. ● A user interaction triggers these special, state changing functions. ● Only one change takes place at a time.
  • 31. Advantages of React JS 1. Virtual DOM in ReactJS makes user experience better and developer’s work faster. 2. Permission to reuse React components significantly saves time. 3. One-direction data flow in ReactJS provides a stable code. 4. An open-source library: constantly developing and open to contributions.
  • 32. Disadvantages of React 1. High pace of development. 2. Poor documentation. 3. ‘HTML in my JavaScript!’ – JSX as a barrier.