Passing data between component

In this article going to show how we can pass data between components.

This is very simple in react

In this example we send data App component to Profile component

 

App component

import React from "react";
import Profile from "./compontents/Profile";

export default function App() {

  return (
    <>
      <Profile userName={"Admin"} email={"example@gmail.com"}></Profile>
    </>
  );

}

 

Profile component

import React from "react";

export default function Profile({ userName, email }) {

  return (
    <>
      <p>usaename: {userName}</p>
      <p>usaename: {email}</p>
    </>
  );

}

 

About Author

Photo

Hi, I am Mahbub Hasan
Software Engineer

I am very much interested to share my programming
and development knowledge with the people.I will try
to update my blog everyday with new technology inshallah.

Thank You

For Visiting My Blog.

Contact Me