'Why is my TSX component does not work with styled components?
I'm having troubles creating a tsx component with styled-components. When using the props as it returns this error: No overload matches this call., even though I defined it. How could I fix this?
This is my code:
interface styleProps {
children: React.ReactNode;
as?: React.ElementType | keyof JSX.IntrinsicElements;
}
const Container = styled.button<styleProps>``
const Button: React.FC<{ to: string, children: React.ReactNode }> = props => {
return (
<Container as={props.to && Link}>
{props.children}
</Container>
)
}
Thanks for your answers!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
