File tree 1 file changed +6
-5
lines changed 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -33,14 +33,19 @@ React.createClass({
33
33
// A React component.
34
34
optionalComponent: React .PropTypes .component ,
35
35
36
+ // You can also declare that a prop is an instance of a class. This uses
37
+ // JS's instanceof operator.
38
+ optionalMessage: React .PropTypes .instanceOf (Message),
39
+
36
40
// You can ensure that your prop is limited to specific values by treating
37
41
// it as an enum.
38
42
optionalEnum: React .PropTypes .oneOf ([' News' , ' Photos' ]),
39
43
40
44
// An object that could be one of many types
41
45
optionalUnion: React .PropTypes .oneOfType ([
42
46
React .PropTypes .string ,
43
- React .PropTypes .number
47
+ React .PropTypes .number ,
48
+ React .PropTypes .instanceOf (Message)
44
49
]),
45
50
46
51
// An array of a certain type
@@ -52,10 +57,6 @@ React.createClass({
52
57
fontSize: React .PropTypes .number
53
58
}),
54
59
55
- // You can also declare that a prop is an instance of a class. This uses
56
- // JS's instanceof operator.
57
- someClass: React .PropTypes .instanceOf (SomeClass),
58
-
59
60
// You can chain any of the above with isRequired to make sure a warning is
60
61
// shown if the prop isn't provided.
61
62
requiredFunc: React .PropTypes .func .isRequired ,
You can’t perform that action at this time.
0 commit comments