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
`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