Passer des composants en tant qu'enfants en réaction
const UserCard = ({ name, children }) => {
return (
<div>
<p>Name: {name}</p>
{children}
</div>
)
}
const UserIcon = ({ profilePic }) => {
return <img src={profilePic} alt="profile" />
}
function App() {
return (
<div>
<UserCard name="Ranjeet">
<UserIcon profilePic="image.jpg" />
</UserCard>
</div>
)
}
export default App
Outrageous Ostrich