Skip to content

Commit ee4937e

Browse files
NMinhNguyendanez
authored andcommitted
Support JSXFragment (#304)
Fixes #298.
1 parent 3fa6771 commit ee4937e

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/utils/__tests__/isStatelessComponent-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ describe('isStatelessComponent', () => {
2323

2424
const componentIdentifiers = {
2525
JSX: '<div />',
26+
JSXFragment: '<></>',
2627
'React.createElement': 'React.createElement("div", null)',
2728
'React.cloneElement': 'React.cloneElement(children, null)',
2829
'React.Children.only()': 'React.Children.only(children, null)',

src/utils/isStatelessComponent.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const validPossibleStatelessComponentTypes = [
3232
function isJSXElementOrReactCall(path) {
3333
return (
3434
path.node.type === 'JSXElement' ||
35+
path.node.type === 'JSXFragment' ||
3536
(path.node.type === 'CallExpression' && isReactCreateElementCall(path)) ||
3637
(path.node.type === 'CallExpression' && isReactCloneElementCall(path)) ||
3738
(path.node.type === 'CallExpression' && isReactChildrenElementCall(path))

0 commit comments

Comments
 (0)