Closed
Description
Hi,
I am trying to understand why the following doesn't work. The defaultValue for hey
and oh
is undefined.
const TO_SPREAD = {
hey: "ho!"
}
export const MyComponent = ({ text }) => {
return <div>{text}</div>
};
MyComponent.propTypes = {
text: PropTypes.string,
hey: PropTypes.string,
oh: PropTypes.string,
};
MyComponent.defaultProps = {
text: "Hey!",
...TO_SPREAD
};
MyComponent.defaultProps.oh = "foo!";
I get the following result:
{
"description": "",
"displayName": "MyComponent",
"methods": [],
"props": {
"text": {
"type": {
"name": "string"
},
"required": false,
"description": "",
"defaultValue": {
"value": "\"Hey!\"",
"computed": false
}
},
"hey": {
"type": {
"name": "string"
},
"required": false,
"description": ""
},
"oh": {
"type": {
"name": "string"
},
"required": false,
"description": ""
}
}
}
Thank you,
Patrick
Metadata
Metadata
Assignees
Labels
No labels