I have a component
const UIComponent = ({ className }: Props) => {
return (
<div
className={classNames(styles.component, styles.green, {
className: className <--how to make it work?
})}
>
Component
</div>
);
};
^ here the className class is simply added, if the className prop is passed, I need to somehow pass the styles through this prop
styles for UIComponent
.component {
font-size: 24px;
}
.green {
color: green;
}
const App = () => {
return (
<>
<UIComponent className={styles.red} />
{/* ^^^ it should be red*/}
<UIComponent />
</>
);
};
styles for App
.App {
font-family: sans-serif;
text-align: center;
}
.red{
color: red;
}
how I can add className in another component