Children Props
- You can pass children to the child component
- In the parent component when we pass data , the things inside the component behaves as children.
- Highlighted below is the children
- <Batsman id=”1″ name=”SKY”>Â Â Â Â <p>This is a special player!!!</p></Batsman>
Â
import React from "react";
const Cricket = () => {
return (
<>
This is a special player!!!
This is a special player!!!
>
);
};
const Batsman = ({ id, name, children }) => {
return (
- {id}
- {name}
{children}
);
};
export default Cricket;