File tree Expand file tree Collapse file tree 1 file changed +75
-0
lines changed Expand file tree Collapse file tree 1 file changed +75
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,15 @@ function Foo(props) {
17
17
}
18
18
```
19
19
20
+ ``` jsx
21
+ function Foo (props ) {
22
+ const { bar } = this .props ;
23
+ return (
24
+ < div> {bar}< / div>
25
+ );
26
+ }
27
+ ```
28
+
20
29
``` jsx
21
30
function Foo (props , context ) {
22
31
return (
@@ -27,6 +36,18 @@ function Foo(props, context) {
27
36
}
28
37
```
29
38
39
+ ``` jsx
40
+ function Foo (props , context ) {
41
+ const { foo } = this .context ;
42
+ const { bar } = this .props ;
43
+ return (
44
+ < div>
45
+ {foo ? bar : ' ' }
46
+ < / div>
47
+ );
48
+ }
49
+ ```
50
+
30
51
``` jsx
31
52
function Foo (props ) {
32
53
if (this .state .loading ) {
@@ -40,6 +61,21 @@ function Foo(props) {
40
61
}
41
62
```
42
63
64
+ ``` jsx
65
+ function Foo (props ) {
66
+ const { loading } = this .state ;
67
+ const { bar } = this .props ;
68
+ if (loading) {
69
+ return < Loader / > ;
70
+ }
71
+ return (
72
+ < div>
73
+ {bar}
74
+ < / div>
75
+ );
76
+ }
77
+ ```
78
+
43
79
The following patterns are ** not** considered warnings:
44
80
45
81
``` jsx
@@ -50,6 +86,23 @@ function Foo(props) {
50
86
}
51
87
```
52
88
89
+ ``` jsx
90
+ function Foo (props ) {
91
+ const { bar } = props;
92
+ return (
93
+ < div> {bar}< / div>
94
+ );
95
+ }
96
+ ```
97
+
98
+ ``` jsx
99
+ function Foo ({ bar }) {
100
+ return (
101
+ < div> {bar}< / div>
102
+ );
103
+ }
104
+ ```
105
+
53
106
``` jsx
54
107
function Foo (props , context ) {
55
108
return (
@@ -59,3 +112,25 @@ function Foo(props, context) {
59
112
);
60
113
}
61
114
```
115
+
116
+ ``` jsx
117
+ function Foo (props , context ) {
118
+ const { foo } = context;
119
+ const { bar } = props;
120
+ return (
121
+ < div>
122
+ {foo ? bar : ' ' }
123
+ < / div>
124
+ );
125
+ }
126
+ ```
127
+
128
+ ``` jsx
129
+ function Foo ({ bar }, { foo }) {
130
+ return (
131
+ < div>
132
+ {foo ? bar : ' ' }
133
+ < / div>
134
+ );
135
+ }
136
+ ```
You can’t perform that action at this time.
0 commit comments