I am creating a reusable component button to which I want to pass two Tailwind classes as props and use them dynamically.
Here is my component:
function Button({ primary, secondry, label, onClick }) {
return (
<button
onClick={(e) => onClick(e)}
className={`bg-${primary} py-0.5 px-3 rounded text-white font-semibold text-xl border-2 border-${primary} hover:bg-${secondry} hover:text-${primary} cursor-pointer duration-300`}
>
{label}
</button>
);
}
This is how I am using the component:
<Button
label={"Cancel"}
primary="red-700"
secondry="zinc-900"
onClick={(e) => navigate("/customers")}
/>
However, the classes are not being applied. This is how it looks: