You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,14 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
`displayName` allows you to [name your context](https://reactjs.org/docs/context.html#contextdisplayname) object. This name is used in the React dev tools for the context's `Provider` and `Consumer`.
134
+
When `true` this rule will warn on context objects without a `displayName`.
135
+
136
+
Examples of **incorrect** code for this rule:
137
+
138
+
```jsx
139
+
constHello=React.createContext();
140
+
```
141
+
142
+
```jsx
143
+
constHello=createContext();
144
+
```
145
+
146
+
Examples of **correct** code for this rule:
147
+
148
+
```jsx
149
+
constHello=React.createContext();
150
+
Hello.displayName="HelloContext";
151
+
```
152
+
153
+
```jsx
154
+
constHello=createContext();
155
+
Hello.displayName="HelloContext";
156
+
```
157
+
131
158
## About component detection
132
159
133
160
For this rule to work we need to detect React components, this could be very hard since components could be declared in a lot of ways.
0 commit comments