props in the functional component in react


const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
   
    <PropsFunctionalComponent name=" Hera" email="hera@gmail.com"/>
  {/*  <PropsFunctionalComponent name=" Hemel" />
    <PropsFunctionalComponent name=" Didar" /> */
}
    <StateClassComponent />
    <User />
  </React.StrictMode>
);





props in the functional component in react:

 import React from "react";

import './User.css';


const PropsFunctionalComponent = (props) => {
    console.log(props.name)
  return (
    <div className="userDiv">
        <h1>props in the functional component in react</h1>
        <h2>Hello,{props.name}</h2>
        <h3>email: {props.email}</h3>
    </div>
  )
}

export default PropsFunctionalComponent

Comments