Update deprecated propTypes
Raymond Ha committed
Oct 29, 2014 at 20:59 UTC
92d171a4fce8d2a44698faa53dbcb9838196ef73
2 files changed
+14
-14
docs/docs/05-reusable-components.md
+6
-6
@@ -25,12 +25,12 @@ React.createClass({
25
optionalObject: React.PropTypes.object,
26
optionalString: React.PropTypes.string,
27
28
- // Anything that can be rendered: numbers, strings, components or an array
28
+ // Anything that can be rendered: numbers, strings, elements or an array
29
// containing these types.
30
- optionalRenderable: React.PropTypes.renderable,
30
+ optionalNode: React.PropTypes.node,
31
32
- // A React component.
33
- optionalComponent: React.PropTypes.component,
32
+ // A React element.
33
+ optionalElement: React.PropTypes.element,
34
35
// You can also declare that a prop is an instance of a class. This uses
36
// JS's instanceof operator.
@@ -120,13 +120,13 @@ React.render(
120
121
## Single Child
122
123
-With `React.PropTypes.component` you can specify that only a single child can be passed to
123
+With `React.PropTypes.element` you can specify that only a single child can be passed to
124
a component as children.
125
126
```javascript
127
var MyComponent = React.createClass({
128
propTypes: {
129
- children: React.PropTypes.component.isRequired
129
+ children: React.PropTypes.element.isRequired
130
},
131
132
render: function() {
perf/tests/propTypes.js
+8
-8
@@ -18,7 +18,7 @@ exports.setup = function(){
18
number: React.PropTypes.number,
19
string: React.PropTypes.string.isRequired,
20
func: React.PropTypes.func.isRequired,
21
- renderable: React.PropTypes.renderable.isRequired,
21
+ node: React.PropTypes.node.isRequired,
22
instanceOf: React.PropTypes.instanceOf(Thing).isRequired
23
},
24
render: function() {
@@ -33,14 +33,14 @@ exports.setup = function(){
33
number: React.PropTypes.number,
34
string: React.PropTypes.string.isRequired,
35
func: React.PropTypes.func.isRequired,
36
- renderable: React.PropTypes.renderable.isRequired,
37
- renderable2: React.PropTypes.renderable.isRequired,
36
+ node: React.PropTypes.node.isRequired,
37
+ node2: React.PropTypes.node.isRequired,
38
instanceOf: React.PropTypes.instanceOf(Thing).isRequired,
39
- component: React.PropTypes.component.isRequired
39
+ element: React.PropTypes.element.isRequired
40
},
41
render: function(){
42
return React.DOM.li(null,
43
- this.props.number + this.props.string + this.props.renderable
43
+ this.props.number + this.props.string + this.props.node
44
);
45
}
46
});
@@ -63,10 +63,10 @@ exports.fn = function(){
63
number: Math.random(),
64
string: 'banana banana banana',
65
func: function() { return 'this is a function'; },
66
- renderable: 'renderable string',
67
- renderable2: [MyReactComponent(), 'a string'],
66
+ node: 'renderable string',
67
+ node2: [MyReactComponent(), 'a string'],
68
instanceOf: new Thing,
69
- component: MyReactComponent()
69
+ element: MyReactComponent()
70
}));
71
};
72