Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/docs/05-reusable-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ React.createClass({
optionalObject: React.PropTypes.object,
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.
optionalRenderable: React.PropTypes.renderable,
optionalNode: React.PropTypes.node,

// A React component.
optionalComponent: React.PropTypes.component,
// A React element.
optionalElement: React.PropTypes.element,

// You can also declare that a prop is an instance of a class. This uses
// JS's instanceof operator.
Expand Down Expand Up @@ -120,13 +120,13 @@ React.render(

## 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.

```javascript
var MyComponent = React.createClass({
propTypes: {
children: React.PropTypes.component.isRequired
children: React.PropTypes.element.isRequired
},

render: function() {
Expand Down
16 changes: 8 additions & 8 deletions perf/tests/propTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports.setup = function(){
number: React.PropTypes.number,
string: React.PropTypes.string.isRequired,
func: React.PropTypes.func.isRequired,
renderable: React.PropTypes.renderable.isRequired,
node: React.PropTypes.node.isRequired,
instanceOf: React.PropTypes.instanceOf(Thing).isRequired
},
render: function() {
Expand All @@ -33,14 +33,14 @@ exports.setup = function(){
number: React.PropTypes.number,
string: React.PropTypes.string.isRequired,
func: React.PropTypes.func.isRequired,
renderable: React.PropTypes.renderable.isRequired,
renderable2: React.PropTypes.renderable.isRequired,
node: React.PropTypes.node.isRequired,
node2: React.PropTypes.node.isRequired,
instanceOf: React.PropTypes.instanceOf(Thing).isRequired,
component: React.PropTypes.component.isRequired
element: React.PropTypes.element.isRequired
},
render: function(){
return React.DOM.li(null,
this.props.number + this.props.string + this.props.renderable
this.props.number + this.props.string + this.props.node
);
}
});
Expand All @@ -63,10 +63,10 @@ exports.fn = function(){
number: Math.random(),
string: 'banana banana banana',
func: function() { return 'this is a function'; },
renderable: 'renderable string',
renderable2: [MyReactComponent(), 'a string'],
node: 'renderable string',
node2: [MyReactComponent(), 'a string'],
instanceOf: new Thing,
component: MyReactComponent()
element: MyReactComponent()
}));
};

Expand Down