Skip to content

Conversation

@trueadm
Copy link
Contributor

@trueadm trueadm commented Apr 10, 2017

This updates the documentation for type-checking with PropTypes, removing the usage of React.PropTypes in favor of the NPM package.

optionalObject: React.PropTypes.object,
optionalString: React.PropTypes.string,
optionalSymbol: React.PropTypes.symbol,
optionalArray: array,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be PropTypes.array

With `PropTypes.element` you can specify that only a single child can be passed to a component as children.

```javascript
import PropTypes from 'prop-types';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just import element since it's the only PropType in the example?

@gaearon
Copy link
Collaborator

gaearon commented Apr 10, 2017

So which import style do we recommend?

@gaearon
Copy link
Collaborator

gaearon commented Apr 11, 2017

I changed to use PropTypes imports everywhere so we don't confuse people who don't know about named imports, and also so that people who use UMD builds can still read this.

@gaearon gaearon merged commit 446f186 into master Apr 11, 2017
@gaearon gaearon deleted the trueadm-proptypes branch April 11, 2017 23:04
gaearon pushed a commit that referenced this pull request Apr 11, 2017
* Update typechecking-with-proptypes.md

* Update typechecking-with-proptypes.md

* Use consistent style for PropTypes import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants