Skip to content

Commit

Permalink
[fix] displayName: avoid a crash when using React.memo
Browse files Browse the repository at this point in the history
  • Loading branch information
golopot committed Mar 7, 2020
1 parent 6bec58e commit 376cb4e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/util/Components.js
Expand Up @@ -483,7 +483,9 @@ function componentRule(rule, context) {
}
if (body.type === 'BlockStatement') {
const jsxElement = body.body.find(item => item.type === 'ReturnStatement');
return jsxElement && this.getComponentNameFromJSXElement(jsxElement.argument);
return jsxElement &&
jsxElement.argument &&
this.getComponentNameFromJSXElement(jsxElement.argument);
}
return null;
},
Expand Down

0 comments on commit 376cb4e

Please sign in to comment.