SlideShare a Scribd company logo
REACT BASICS
Intro
ReactJS is a declarative, efficient, and flexible JavaScript library for
building reusable UI components. It is an open-source, component-
based front end library responsible only for the view layer of the
application.It lets you compose complex UIs from small and isolated
pieces of code called “components”
Latest Version: 16.13.1 (March, 2020)
Ways To Install ReactJs
● Using the npm command
● Using the create-react-app command
React Features
● JSX
● Components
● One way data binding
● Virtual Dom
● Simplicity
● Performance
React
Components
● Functional Component
● Class Component
Class Component
class ShoppingList extends React.Component {
render() {
return (
<div className="shopping-list">
<h1>Shopping List for
{this.props.name}</h1>
<ul>
<li>Instagram</li>
<li>WhatsApp</li>
<li>Oculus</li>
</ul>
</div>
);
}
}
A class component takes
in parameters, called
props (short for
“properties”), and returns a
hierarchy of views to
display via the render
method.
Function
Component
function Welcome(props) {
return <h1>Welcome to the ,{props.name}</h1>;
}
Function components are a
way to write components
that only contain a render
method and don't have their
own state. They are simply
JavaScript functions that
may or may not receive data
as parameters.
“React State”
The state is an updatable structure that is used to contain data or information about the
component. They are also responsible for making a component dynamic and interactive.
It can be set by using the setState() method and calling setState() method triggers UI updates.
this.state = { displayBio: true };
this.setState({displayBio: !this.state.displayBio});
“React Props”
Props stand for "Properties." They are read-only components.It gives a way to pass data from
one component to other components.Props are passed to the component in the same way as
arguments passed in a function.
Props are immutable so we cannot modify the props from inside the component.
These attributes are available in the component as this.props and can be used to render
dynamic data in our render method.
Component Life Cycle
React Keys
A key is a unique identifier. In React, it is used to identify which items have
changed, updated, or deleted from the Lists. It is useful when we dynamically
created components or when the users alter the lists. It also helps to determine
which components in a collection needs to be re-rendered instead of re-
rendering the entire set of components every time.
const stringLists = [ 'Peter', 'Sachin', 'Kevin', 'Dhoni', 'Alisa' ];
const updatedLists = stringLists.map((strList, index)=>{
<li key={index}> {strList} </li>;
});
React Refs
Refs is the shorthand used for references in React. It is similar to keys in React.
It is an attribute which makes it possible to store a reference to particular DOM
nodes or React elements. It provides a way to access React DOM nodes or
React elements and how to interact with it.
In React, Refs can be created by using React.createRef();
When To Use Refs
● When we need DOM
measurements such as
managing focus, text
selection, or media
playback.
● It is used in triggering
imperative animations.
● When integrating with third-
party DOM libraries.
Thanks!
Lets Move To Example...

More Related Content

PPTX
Mysql creating stored function
PPTX
Services Factory Provider Value Constant - AngularJS
PDF
React JS & Functional Programming Principles
PPTX
Dependency Inversion in large-scale TypeScript applications with InversifyJS
DOCX
PPTX
Introduction to React JS for beginners
PDF
Introduction to React Hooks
PDF
React js use contexts and useContext hook
Mysql creating stored function
Services Factory Provider Value Constant - AngularJS
React JS & Functional Programming Principles
Dependency Inversion in large-scale TypeScript applications with InversifyJS
Introduction to React JS for beginners
Introduction to React Hooks
React js use contexts and useContext hook

What's hot (20)

PPTX
Intro to React
PPTX
How To Utilize Context API With Class And Functional Componen in React.pptx
PPTX
React & Redux JS
PDF
React and MobX: A Truly Reactive App
PPTX
Linq
PPTX
Functional programing jargon
PDF
23 ijaprr vol1-3-25-31iqra
PPTX
React JS - A quick introduction tutorial
PDF
React and redux
PDF
Basic Fundamental of Redux
PPTX
The Benefits of Using React JS for Web Development!
PPTX
Redux workshop
DOC
Plsql
PPTX
reactJS
ODP
Introduction to ReactJS
PPTX
React-JS Component Life-cycle Methods
PPTX
Mule java part-4
PPT
3.1\9 SSIS 2008R2_Training - ControlFlow asks
PPTX
[Final] ReactJS presentation
Intro to React
How To Utilize Context API With Class And Functional Componen in React.pptx
React & Redux JS
React and MobX: A Truly Reactive App
Linq
Functional programing jargon
23 ijaprr vol1-3-25-31iqra
React JS - A quick introduction tutorial
React and redux
Basic Fundamental of Redux
The Benefits of Using React JS for Web Development!
Redux workshop
Plsql
reactJS
Introduction to ReactJS
React-JS Component Life-cycle Methods
Mule java part-4
3.1\9 SSIS 2008R2_Training - ControlFlow asks
[Final] ReactJS presentation
Ad

Similar to React basics (20)

PDF
React Interview Question & Answers PDF By ScholarHat
PPTX
Unit 2 Fundamentals of React -------.pptx
PPTX
Dyanaimcs of business and economics unit 2
PPTX
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
PPTX
React-JS.pptx
PDF
Reactjs: Rethinking UI Devel
PPTX
React & Redux for noobs
PPTX
ReactJS (1)
PDF
All about React Js
PDF
100 React Interview questions 2024.pptx.pdf
PDF
react hook and wesite making structure ppt
PPTX
React State vs Props Introduction & Differences.pptx
PPTX
UIF(UI Frame work)Notes MRUH_UNIT 2.pptx
PPTX
PDF
unit 3_Adv WTAdvanced Web Tecg Design_HTML_CSS_JAVASCRIPT_AJAX_PPT.pdf
PPTX
React advance
PDF
The Ultimate Guide to ReactJS Components.pdf
PDF
react.pdf
PPTX
react-slides.pptx
React Interview Question & Answers PDF By ScholarHat
Unit 2 Fundamentals of React -------.pptx
Dyanaimcs of business and economics unit 2
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React-JS.pptx
Reactjs: Rethinking UI Devel
React & Redux for noobs
ReactJS (1)
All about React Js
100 React Interview questions 2024.pptx.pdf
react hook and wesite making structure ppt
React State vs Props Introduction & Differences.pptx
UIF(UI Frame work)Notes MRUH_UNIT 2.pptx
unit 3_Adv WTAdvanced Web Tecg Design_HTML_CSS_JAVASCRIPT_AJAX_PPT.pdf
React advance
The Ultimate Guide to ReactJS Components.pdf
react.pdf
react-slides.pptx
Ad

Recently uploaded (20)

PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Nekopoi APK 2025 free lastest update
PDF
Digital Strategies for Manufacturing Companies
PPTX
Transform Your Business with a Software ERP System
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
medical staffing services at VALiNTRY
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
AI in Product Development-omnex systems
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
How Creative Agencies Leverage Project Management Software.pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Nekopoi APK 2025 free lastest update
Digital Strategies for Manufacturing Companies
Transform Your Business with a Software ERP System
VVF-Customer-Presentation2025-Ver1.9.pptx
Reimagine Home Health with the Power of Agentic AI​
Upgrade and Innovation Strategies for SAP ERP Customers
medical staffing services at VALiNTRY
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
2025 Textile ERP Trends: SAP, Odoo & Oracle
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Operating system designcfffgfgggggggvggggggggg
Softaken Excel to vCard Converter Software.pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
AI in Product Development-omnex systems
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PTS Company Brochure 2025 (1).pdf.......
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
How Creative Agencies Leverage Project Management Software.pdf

React basics

  • 2. Intro ReactJS is a declarative, efficient, and flexible JavaScript library for building reusable UI components. It is an open-source, component- based front end library responsible only for the view layer of the application.It lets you compose complex UIs from small and isolated pieces of code called “components” Latest Version: 16.13.1 (March, 2020)
  • 3. Ways To Install ReactJs ● Using the npm command ● Using the create-react-app command
  • 4. React Features ● JSX ● Components ● One way data binding ● Virtual Dom ● Simplicity ● Performance
  • 6. Class Component class ShoppingList extends React.Component { render() { return ( <div className="shopping-list"> <h1>Shopping List for {this.props.name}</h1> <ul> <li>Instagram</li> <li>WhatsApp</li> <li>Oculus</li> </ul> </div> ); } } A class component takes in parameters, called props (short for “properties”), and returns a hierarchy of views to display via the render method.
  • 7. Function Component function Welcome(props) { return <h1>Welcome to the ,{props.name}</h1>; } Function components are a way to write components that only contain a render method and don't have their own state. They are simply JavaScript functions that may or may not receive data as parameters.
  • 8. “React State” The state is an updatable structure that is used to contain data or information about the component. They are also responsible for making a component dynamic and interactive. It can be set by using the setState() method and calling setState() method triggers UI updates. this.state = { displayBio: true }; this.setState({displayBio: !this.state.displayBio});
  • 9. “React Props” Props stand for "Properties." They are read-only components.It gives a way to pass data from one component to other components.Props are passed to the component in the same way as arguments passed in a function. Props are immutable so we cannot modify the props from inside the component. These attributes are available in the component as this.props and can be used to render dynamic data in our render method.
  • 11. React Keys A key is a unique identifier. In React, it is used to identify which items have changed, updated, or deleted from the Lists. It is useful when we dynamically created components or when the users alter the lists. It also helps to determine which components in a collection needs to be re-rendered instead of re- rendering the entire set of components every time. const stringLists = [ 'Peter', 'Sachin', 'Kevin', 'Dhoni', 'Alisa' ]; const updatedLists = stringLists.map((strList, index)=>{ <li key={index}> {strList} </li>; });
  • 12. React Refs Refs is the shorthand used for references in React. It is similar to keys in React. It is an attribute which makes it possible to store a reference to particular DOM nodes or React elements. It provides a way to access React DOM nodes or React elements and how to interact with it. In React, Refs can be created by using React.createRef();
  • 13. When To Use Refs ● When we need DOM measurements such as managing focus, text selection, or media playback. ● It is used in triggering imperative animations. ● When integrating with third- party DOM libraries.
  • 14. Thanks! Lets Move To Example...