-
-
Notifications
You must be signed in to change notification settings - Fork 302
Closed
Labels
Description
Is it possible to infer the default property value from a stateless component defined like this?
export function StatelessComponent({ name = 'Bob' }) {
return <p>{name}</p>;
}
StatelessComponent.propTypes = {
name: React.PropTypes.string
};
It's a bit more concise that the current alternative:
export function StatelessComponent({ name }) {
return <p>{name}</p>;
}
StatelessComponent.propTypes = {
name: React.PropTypes.string
};
StatelessComponent.defaultProps = { name: 'Bob' };