Skip to content

Commit

Permalink
Add example for PropTypes.exact
Browse files Browse the repository at this point in the history
  • Loading branch information
jaller94 committed Apr 12, 2018
1 parent 7cc8c81 commit 2bde8eb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -108,6 +108,12 @@ MyComponent.propTypes = {
fontSize: PropTypes.number
}),

// An object with warnings on extra properties
optionalObjectWithStrictShape: PropTypes.exact({
color: PropTypes.string,
fontSize: PropTypes.number
}),

// 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,
Expand Down

0 comments on commit 2bde8eb

Please sign in to comment.