Browse Source

Update deprecated propTypes

main
Raymond Ha 10 years ago
parent
commit
2f51451165
  1. 12
      docs/05-reusable-components.md

12
docs/05-reusable-components.md

@ -25,12 +25,12 @@ React.createClass({
optionalObject: React.PropTypes.object, optionalObject: React.PropTypes.object,
optionalString: React.PropTypes.string, optionalString: React.PropTypes.string,
// Anything that can be rendered: numbers, strings, components or an array // Anything that can be rendered: numbers, strings, elements or an array
// containing these types. // containing these types.
optionalRenderable: React.PropTypes.renderable, optionalNode: React.PropTypes.node,
// A React component. // A React element.
optionalComponent: React.PropTypes.component, optionalElement: React.PropTypes.element,
// You can also declare that a prop is an instance of a class. This uses // You can also declare that a prop is an instance of a class. This uses
// JS's instanceof operator. // JS's instanceof operator.
@ -120,13 +120,13 @@ React.render(
## Single Child ## Single Child
With `React.PropTypes.component` you can specify that only a single child can be passed to With `React.PropTypes.element` you can specify that only a single child can be passed to
a component as children. a component as children.
```javascript ```javascript
var MyComponent = React.createClass({ var MyComponent = React.createClass({
propTypes: { propTypes: {
children: React.PropTypes.component.isRequired children: React.PropTypes.element.isRequired
}, },
render: function() { render: function() {

Loading…
Cancel
Save