Reusable Select styles with generic type #4754
-
Hey, I would like to create resable react-select component. But I got problem with figure out good types. I created codesandbox where you can check what I would like to achieve. Basically Select component have Generic OptionType, and it works fine until I want to add custom styles and custom OptionComponent. I think it is just impossible to have it generic. Do you have any idea is there any solution? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
If your |
Beta Was this translation helpful? Give feedback.
If your
Option
type is always going to beMyOptionType
you can remove the generic like this: https://codesandbox.io/s/63696310-how-to-use-typescript-with-the-definition-of-custom-styles-for-a-select-using-re-forked-oix91?file=/src/App.tsx.