SlideShare a Scribd company logo
Introduction to React.js
Components
Understanding Functional & Class Components
What is React.js?
 - A JavaScript library for building user
interfaces
 - Component-based architecture
 - Developed by Facebook
What is a Component?
 - Reusable, independent pieces of UI
 - Two types:
 - Functional Components (Modern & Preferred)
 - Class Components (Legacy & Less Common)
Functional Components (Introduction)
 - Simple JavaScript functions
 - Return JSX (UI structure)
 - Use React Hooks (useState, useEffect) for managing state &
lifecycle
 Example:
 function Welcome() {
 return <h1>Hello, React!</h1>;
 }
Class Components (Introduction)
 - ES6 JavaScript classes that extend React.Component
 - Use lifecycle methods
 Example:
 class Welcome extends React.Component {
 render() {
 return <h1>Hello, React!</h1>;
 }
 }
Props in Components
 - Props allow data to be passed between components
 Example:
 function Greeting(props) {
 return <h1>Hello, {props.name}!</h1>;
 }
 Usage:
 <Greeting name="Vaibhav" />
State in Components
 - State allows components to manage dynamic data
 Example (useState Hook):
 import { useState } from 'react';
 function Counter() {
 const [count, setCount] = useState(0);
 return (
 <div>
 <p>Count: {count}</p>
 <button onClick={() => setCount(count + 1)}>Increment</button>
 </div>
 );
 }
Lifecycle Methods (Class Components)
 - componentDidMount(): Runs after component
mounts
 - componentDidUpdate(): Runs after state/props
update
 - componentWillUnmount(): Runs before
component unmounts
Lifecycle Hooks (Functional
Components)
 - useEffect() replaces lifecycle methods
 Example:
 import { useEffect } from 'react';
 function Example() {
 useEffect(() => {
 console.log("Component Mounted!");
 }, []);
 return <p>Check the console!</p>;
 }
Component Communication
 - Parent to Child: Pass props
 - Child to Parent: Use callback functions
 - Sibling Communication: Use a shared state
Controlled vs Uncontrolled Components
 - Controlled Components: State-driven form
elements
 - Uncontrolled Components: Use ref instead of
state
Higher-Order Components (HOCs)
 - Functions that take a component and return a
new enhanced component
 Example: withLogging(Component)
React Fragments & Keys
 - <>...</> avoids extra divs in the DOM
 - Keys help React identify list elements
Summary & Q&A
 - Recap main points
 - Encourage questions

More Related Content

Similar to ReactJS_Components_Presentation for freshers (20)

PDF
Understanding React hooks | Walkingtree Technologies
Walking Tree Technologies
 
PPTX
React JS Workings Exercises Extra Classes
ssuser426fcf
 
ODP
Introduction to ReactJS
Knoldus Inc.
 
PDF
React js
Rajesh Kolla
 
PDF
Introduction Web Development using ReactJS
ssuser8a1f37
 
PPTX
ReactJS presentation.pptx
DivyanshGupta922023
 
PDF
Fundamental Concepts of React JS for Beginners.pdf
StephieJohn
 
PDF
Getting Started with React, When You’re an Angular Developer
Fabrit Global
 
PPTX
class based component.pptx
saikatsamanta49
 
PDF
React – Let’s “Hook” up
InnovationM
 
PPTX
React Class Components vs Functional Components: Which is Better?
Fibonalabs
 
PDF
unit 3_Adv WTAdvanced Web Tecg Design_HTML_CSS_JAVASCRIPT_AJAX_PPT.pdf
GauravDwivedi695361
 
PDF
REACTJS.pdf
ArthyR3
 
PPTX
ReactJS
Ram Murat Sharma
 
PPTX
Introduction to ReactJS UI Web Dev .pptx
SHAIKIRFAN715544
 
PPTX
React
manii kanta
 
PPTX
Introduction to React JS.pptx
SHAIKIRFAN715544
 
PDF
React Interview Questions and Answers by Scholarhat
Scholarhat
 
PPTX
React workshop
Imran Sayed
 
PDF
Integrating React.js with PHP projects
Ignacio Martín
 
Understanding React hooks | Walkingtree Technologies
Walking Tree Technologies
 
React JS Workings Exercises Extra Classes
ssuser426fcf
 
Introduction to ReactJS
Knoldus Inc.
 
React js
Rajesh Kolla
 
Introduction Web Development using ReactJS
ssuser8a1f37
 
ReactJS presentation.pptx
DivyanshGupta922023
 
Fundamental Concepts of React JS for Beginners.pdf
StephieJohn
 
Getting Started with React, When You’re an Angular Developer
Fabrit Global
 
class based component.pptx
saikatsamanta49
 
React – Let’s “Hook” up
InnovationM
 
React Class Components vs Functional Components: Which is Better?
Fibonalabs
 
unit 3_Adv WTAdvanced Web Tecg Design_HTML_CSS_JAVASCRIPT_AJAX_PPT.pdf
GauravDwivedi695361
 
REACTJS.pdf
ArthyR3
 
Introduction to ReactJS UI Web Dev .pptx
SHAIKIRFAN715544
 
Introduction to React JS.pptx
SHAIKIRFAN715544
 
React Interview Questions and Answers by Scholarhat
Scholarhat
 
React workshop
Imran Sayed
 
Integrating React.js with PHP projects
Ignacio Martín
 

More from vaibhavdtambe2003 (8)

PPTX
js main.pptx sdkfhlsjfdkljskljkljkjkjflsjdfjskjsl
vaibhavdtambe2003
 
PPTX
Civil_Engineering_Training_Session.pptx hdjkf
vaibhavdtambe2003
 
PPTX
txWelcome to Javascript Welcome to Javascript.pp
vaibhavdtambe2003
 
PPTX
ReactJS_First_Practical for the freshers.pptx
vaibhavdtambe2003
 
PPTX
Computers_as_Problem_Solving_Tools sdklfj
vaibhavdtambe2003
 
PPTX
Types_of_Cloud_Computing_Public_Private_Hybrid.pptx
vaibhavdtambe2003
 
PPTX
Types_of_Cloud_Computing_Public_Private_Hybrid.pptx
vaibhavdtambe2003
 
PPTX
Computers_as_Problem_Solving_Tools for computer
vaibhavdtambe2003
 
js main.pptx sdkfhlsjfdkljskljkljkjkjflsjdfjskjsl
vaibhavdtambe2003
 
Civil_Engineering_Training_Session.pptx hdjkf
vaibhavdtambe2003
 
txWelcome to Javascript Welcome to Javascript.pp
vaibhavdtambe2003
 
ReactJS_First_Practical for the freshers.pptx
vaibhavdtambe2003
 
Computers_as_Problem_Solving_Tools sdklfj
vaibhavdtambe2003
 
Types_of_Cloud_Computing_Public_Private_Hybrid.pptx
vaibhavdtambe2003
 
Types_of_Cloud_Computing_Public_Private_Hybrid.pptx
vaibhavdtambe2003
 
Computers_as_Problem_Solving_Tools for computer
vaibhavdtambe2003
 
Ad

Recently uploaded (20)

PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PPTX
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
PDF
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
PPTX
QUARTER 1 WEEK 2 PLOT, POV AND CONFLICTS
KynaParas
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PPTX
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PPTX
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
Dimensions of Societal Planning in Commonism
StefanMz
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
QUARTER 1 WEEK 2 PLOT, POV AND CONFLICTS
KynaParas
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Ad

ReactJS_Components_Presentation for freshers

  • 2. What is React.js?  - A JavaScript library for building user interfaces  - Component-based architecture  - Developed by Facebook
  • 3. What is a Component?  - Reusable, independent pieces of UI  - Two types:  - Functional Components (Modern & Preferred)  - Class Components (Legacy & Less Common)
  • 4. Functional Components (Introduction)  - Simple JavaScript functions  - Return JSX (UI structure)  - Use React Hooks (useState, useEffect) for managing state & lifecycle  Example:  function Welcome() {  return <h1>Hello, React!</h1>;  }
  • 5. Class Components (Introduction)  - ES6 JavaScript classes that extend React.Component  - Use lifecycle methods  Example:  class Welcome extends React.Component {  render() {  return <h1>Hello, React!</h1>;  }  }
  • 6. Props in Components  - Props allow data to be passed between components  Example:  function Greeting(props) {  return <h1>Hello, {props.name}!</h1>;  }  Usage:  <Greeting name="Vaibhav" />
  • 7. State in Components  - State allows components to manage dynamic data  Example (useState Hook):  import { useState } from 'react';  function Counter() {  const [count, setCount] = useState(0);  return (  <div>  <p>Count: {count}</p>  <button onClick={() => setCount(count + 1)}>Increment</button>  </div>  );  }
  • 8. Lifecycle Methods (Class Components)  - componentDidMount(): Runs after component mounts  - componentDidUpdate(): Runs after state/props update  - componentWillUnmount(): Runs before component unmounts
  • 9. Lifecycle Hooks (Functional Components)  - useEffect() replaces lifecycle methods  Example:  import { useEffect } from 'react';  function Example() {  useEffect(() => {  console.log("Component Mounted!");  }, []);  return <p>Check the console!</p>;  }
  • 10. Component Communication  - Parent to Child: Pass props  - Child to Parent: Use callback functions  - Sibling Communication: Use a shared state
  • 11. Controlled vs Uncontrolled Components  - Controlled Components: State-driven form elements  - Uncontrolled Components: Use ref instead of state
  • 12. Higher-Order Components (HOCs)  - Functions that take a component and return a new enhanced component  Example: withLogging(Component)
  • 13. React Fragments & Keys  - <>...</> avoids extra divs in the DOM  - Keys help React identify list elements
  • 14. Summary & Q&A  - Recap main points  - Encourage questions