-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DefaultProps #1
Comments
Decorators hide static properties.. |
Sorry, but I don’t understand your answer. I’d like to know how I can define propTypes and defaultProps on the component that is being decorated? |
In general you define default properties and their types like so: class MyComponent {
static propTypes: {
message: PropTypes.string.isRequired
};
static defaultProps: {
message: 'Welcome!'
};
render() {
return <div>{this.props.message}</div>;
}
} ...but the problem is, if you wrap this class into a higher-level component, HOC will hide static properties of the ownee class. |
Does that mean that it is useless to have |
@Frikki Got any solution for accessing the props?? Any work around |
|
How can you specify defaultProps on the ownee class?
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/13446506-defaultprops?utm_campaign=plugin&utm_content=tracker%2F16182690&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F16182690&utm_medium=issues&utm_source=github).The text was updated successfully, but these errors were encountered: