Dynamically Add Props To A Child Component
const ParentWithClick = ({ children }) => {
return (
<children.type
{...children.props}
onClick={() => alert("You clicked me!")}
/>
);
};const App = () => {
return (
<ParentWithClick>
<span>Hello!</span>
</ParentWithClick>
);
};Last updated