Closed janhartmann closed 5 years ago
Why are you extending the your component props with ThemeProviderProps
when it's using withTheme
?
It could also be a problem of your react-jss
typings.
Maybe I am misusing this.
I need to access my theme
inside the component and in order to get typings, I need to make my component be aware of the Theme?
Do you recommend doing this instead:
export interface ILogoProps extends StyledComponentProps {
condensed?: boolean;
theme?: ITheme;
}
I am also using the @types/react-jss
if that helps? :)
Yes, though the theme
doesn't need to be optional.
If you remove the injectSheet call and the StyledComponentProps, does the component then work properly?
I must have misused this libary, by not using imports from theming
directly, and only rely on importing from react-jss
all issues are going away.
I have a component like so:
When I use this component from another component, e.g.:
I get a TypeScript error saying:
If I switch the
withTheme(...)
to wrap likeexport default withTheme(injectSheet(styles)(Logo));
the same error arrives on that line.Am I doing something wrong?