File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,39 @@ function Hello({ name }) {
2929}
3030```
3131
32+ Examples of correct usage without warnings:
33+
34+ ``` jsx
35+ var Hello = React .createClass ({
36+ propTypes: {
37+ name: React .PropTypes .string .isRequired ,
38+ },
39+ render : function () {
40+ return < div> Hello {this .props .name }< / div> ;
41+ },
42+ });
43+
44+ // Or in ES6:
45+ class HelloEs6 extends React .Component {
46+ render () {
47+ return < div> Hello {this .props .name }< / div> ;
48+ }
49+ }
50+ HelloEs6 .propTypes = {
51+ name: React .PropTypes .string .isRequired ,
52+ };
53+
54+ // ES6 + Public Class Fields (draft: https://tc39.github.io/proposal-class-public-fields/)
55+ class HelloEs6WithPublicClassField extends React .Component {
56+ static propTypes = {
57+ name: React .PropTypes .string .isRequired ,
58+ }
59+ render () {
60+ return < div> Hello {this .props .name }< / div> ;
61+ }
62+ }
63+ ```
64+
3265The following patterns are not considered warnings:
3366
3467``` jsx
You can’t perform that action at this time.
0 commit comments