I've just started using styled components and it took way too long to figure out how to get type checking for styled components with props:
If you're using typescript, your editor will give you this warning:
Luckily, styled components can have generics types, so we just need to create a type for the its props and pass it as a generic:
No more type errors! :)
Top comments (0)