stitches icon indicating copy to clipboard operation
stitches copied to clipboard

Polymorphism for Composing React Components

Open Code-Victor opened this issue 3 years ago • 0 comments

I need "as" prop for polymorphism in a styled react component. I've accessed the styles and variants through the className prop, but I don't know if there's a way to get it.

const baseButton = ({ onclick, className, children }) => {
  //...
  return <button className={className}>{children}</button>;
};
const Button = styled(baseButton, {
  //styles...
});

Code-Victor avatar Sep 21 '22 11:09 Code-Victor