Skip to content

Commit

Permalink
Move explanation of isRequired and show it in PropTypes.shape
Browse files Browse the repository at this point in the history
  • Loading branch information
jaller94 committed Apr 12, 2018
1 parent ba3da12 commit a36cda8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Expand Up @@ -102,10 +102,13 @@ MyComponent.propTypes = {
// An object with property values of a certain type
optionalObjectOf: PropTypes.objectOf(PropTypes.number),

// You can chain any of the above with `isRequired` to make sure a warning
// is shown if the prop isn't provided.

// An object taking on a particular shape
optionalObjectWithShape: PropTypes.shape({
color: PropTypes.string,
fontSize: PropTypes.number
optionalProperty: PropTypes.string,
requiredProperty: PropTypes.number.isRequired
}),

// An object with warnings on extra properties
Expand All @@ -114,8 +117,6 @@ MyComponent.propTypes = {
requiredProperty: PropTypes.number.isRequired
}),

// You can chain any of the above with `isRequired` to make sure a warning
// is shown if the prop isn't provided.
requiredFunc: PropTypes.func.isRequired,

// A value of any data type
Expand Down

0 comments on commit a36cda8

Please sign in to comment.