diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bce4b03ce..78857b967a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange * [Docs] HTTP => HTTPS ([#3133][] @Schweinepriester) * [readme] Some grammar fixes ([#3186][] @JJ) * [Docs] [`jsx-no-target-blank`]: Improve readme ([#3169][] @apepper) +* [Docs] [`display-name`]: improve examples ([#3189][] @golopot) +[#3189]: https://github.com/yannickcr/eslint-plugin-react/pull/3189 [#3186]: https://github.com/yannickcr/eslint-plugin-react/pull/3186 [#3174]: https://github.com/yannickcr/eslint-plugin-react/pull/3174 [#3169]: https://github.com/yannickcr/eslint-plugin-react/pull/3169 diff --git a/docs/rules/display-name.md b/docs/rules/display-name.md index 9c0d911623..cc895ffd7e 100644 --- a/docs/rules/display-name.md +++ b/docs/rules/display-name.md @@ -12,6 +12,14 @@ var Hello = createReactClass({ return
Hello {this.props.name}
; } }); + +const Hello = React.memo(({ a }) => { + return <>{a} +}) + +export default ({ a }) => { + return <>{a} +} ``` Examples of **correct** code for this rule: @@ -23,6 +31,10 @@ var Hello = createReactClass({ return
Hello {this.props.name}
; } }); + +const Hello = React.memo(function Hello({ a }) { + return <>{a} +}) ``` ## Rule Options @@ -37,7 +49,7 @@ var Hello = createReactClass({ When `true` the rule will ignore the name set by the transpiler and require a `displayName` property in this case. -Examples of **correct** code for this rule: +Examples of **correct** code for `{ ignoreTranspilerName: true }` option: ```jsx var Hello = createReactClass({ @@ -66,7 +78,7 @@ export default function Hello({ name }) { Hello.displayName = 'Hello'; ``` -Examples of **incorrect** code for this rule: +Examples of **incorrect** code for `{ ignoreTranspilerName: true }` option: ```jsx var Hello = createReactClass({