I am creating a react functional component in which I want to display an icon.
function Item(props) {
return ({props.icon});
}
and I display it like this -
<Item icon={<FaIcon />} />
Is there a way to pass in props to the icon from the Item component?
Something like this -
function Item(props) {
return ({props.icon(props: {})});
}
first you need to send the raw component as a prop
<Item icon={FaIcon} />
Then you render it like a component
function Item(props) {
return (<props.icon /* Here goes the props */ /> );
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With