Created
December 28, 2020 11:44
-
-
Save ThaddeusJiang/26201b942649c342c1486b60e771ace3 to your computer and use it in GitHub Desktop.
JavaScript defaultProps 容易出bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const defaultProps = { | |
editable: { | |
name: true, | |
age: true, | |
} | |
} | |
<Card /> // ok | |
<Card editable={{ name: false }} /> // NG, because you lose `editable.age` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment