I'll explain one of the best way (in my opinion) to keep your React components clean and reusable. I'll be using TypeScript for this and we'll start with a simple Button component: type Props = { children: string } function Button({ children }: Pr...
Markdown supported · ⌘↵ to post
I didn’t understand.
Apart from using Typescript? What’s the benefit? Are you suggesting to use typescript for better components or to use enum? If its not typescript, how do we go about it.
Am I missing something?
Saša Šijak
For me it is much cleaner to do it like this:
size: "sm" | "md" | "lg"That way you do not have to import
Sizestype everywhere and type it in each prop and you still get type check