I have a component SampleComponent.tsx:
import React from 'react';
type Props = { text: string };
export const SampleComponent: React.FC<Props> = ({text})=><div>{text}</div>;
SampleComponent.variant1 = ({text})=><div>{'variant1' + text}</div>;
When I try using SampleComponent.variant1 in other components, I get typescript error:
Property 'variant1' does not exist on type ...
Right now I am just casting type with as, but I think there is a better way.
How can I fix this?
Edit: How to type if I have dynamic variants - from 1 to 4 such - .variant1, .variant2, .variant3 and .variant4