Raja Muhammad Asher
Raja Muhammad Asher

Raja Muhammad Asher

How to pass data between react components?

Photo by Lautaro Andreani on Unsplash

How to pass data between react components?

Raja Muhammad Asher's photo
Raja Muhammad Asher
·Aug 11, 2022·

1 min read

React components use props to communicate with each other. Every parent component can pass some information to its child components by giving them props. Props might remind you of HTML attributes, but you can pass any JavaScript value through them, including objects, arrays, and functions.

export default function Profile() {
  return (
    <Avatar
      person={{ name: 'Lin Lanying', imageId: '1bX5QH6' }}
      size={100}
    />
  );
}

Sources:

Passing Props to a Component. beta.reactjs.org/learn/passing-props-to-a-c...

 
Share this