Closed alexeyMohnatkin closed 7 years ago
That's weird. All test are passing and there is a default value set up, it shouldn't fail unless you give an option that is not a function there. @alexeyMohnatkin please give us an example! :)
I need time to make example. I didin't pass any new options. I've just updated react-css-themr and got this error.
It happens when I define defaultProps for decorated component. https://www.webpackbin.com/bins/-Kk0TTaHGCq00TebCuG1
@alexeyMohnatkin This happens because you overwrite statics after decorating the class. Just add them as static properties:
@themr(Symbol())
class Foo {
static defaultProps = {};
static propTypes = {};
}
Or extend them instead of overwriting:
Foo.defaultProps = {
custom: 123,
...Foo.defaultProps
};
I've already found solution, thank you
I think the error message is not helpful. I have accidentally put defaultProps
for one of the components using react-css-themr
and got this error message "Uncaught TypeError: this.props.mapThemrProps is not a function" where no one has any clue where to find the root cause.
The expected behavior will be no runtime error if someone overrides the defaultProps
in another component.
@alexeyMohnatkin what is the solution that you found?
@idangozlan it's described here https://github.com/javivelasco/react-css-themr/issues/61#issuecomment-301258266
@alexeyMohnatkin Could you please provide a minimal representation gist/repo? I cannot reproduce the error.