Ad

ReactJs PropTypes Type Options

- 1 answer

In by Component below, I would like to require additional ReactPropTypes, but I am unsure of my options.

var ContactItem = React.createClass({
  propTypes: {
    name: ReactPropTypes.string,
    number: ReactPropTypes.?????
  }
)}

What are the additional types that can be required?

Ad

Answer

To give you a few basic ones:

React.PropTypes.bool
React.PropTypes.func
React.PropTypes.number
React.PropTypes.object
React.PropTypes.string

But I may advice you do go to the React docs for reusable components, where you can find all the possibles values.

Ad
source: stackoverflow.com
Ad