Skip to content

Commit e7484b7

Browse files
authored
[Docs] display-name: improve examples
1 parent 2dfe98f commit e7484b7

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

docs/rules/display-name.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ var Hello = createReactClass({
1212
return <div>Hello {this.props.name}</div>;
1313
}
1414
});
15+
16+
const Hello = React.memo(({ a }) => {
17+
return <>{a}</>
18+
})
19+
20+
export default ({ a }) => {
21+
return <>{a}</>
22+
}
1523
```
1624

1725
Examples of **correct** code for this rule:
@@ -23,6 +31,10 @@ var Hello = createReactClass({
2331
return <div>Hello {this.props.name}</div>;
2432
}
2533
});
34+
35+
const Hello = React.memo(function Hello({ a }) {
36+
return <>{a}</>
37+
})
2638
```
2739

2840
## Rule Options
@@ -37,7 +49,7 @@ var Hello = createReactClass({
3749

3850
When `true` the rule will ignore the name set by the transpiler and require a `displayName` property in this case.
3951

40-
Examples of **correct** code for this rule:
52+
Examples of **correct** code for `{ ignoreTranspilerName: true }` option:
4153

4254
```jsx
4355
var Hello = createReactClass({
@@ -66,7 +78,7 @@ export default function Hello({ name }) {
6678
Hello.displayName = 'Hello';
6779
```
6880

69-
Examples of **incorrect** code for this rule:
81+
Examples of **incorrect** code for `{ ignoreTranspilerName: true }` option:
7082

7183
```jsx
7284
var Hello = createReactClass({

0 commit comments

Comments
 (0)