π€Props Based Component Calling
React components use props to communicate with each other.
Component 1: "User.jsx" who works based "Props Data"
const User = (props) => {
return (
<section>
<img src={props.img} alt={props.name} width={200} />
<h1>Name: {props.name}</h1>
<h2>Age: {props.age}</h2>
<h3>Is married: {props.isMarried}</h3>
<h4>Hobbies: {props.hobbies} </h4>
</section>
);
};
export default User;App.jsx who calls the user components with props
const App = () => {
return (
<User
img="https://avatars.githubusercontent.com/u/85052811?v=4"
name="HuXn WebDev"
age={18}
isMarried={false}
hobbies={["Coding", "Reading", "Sleeping"]}
/>
);
};
export default App;Last updated