Skip to content

Commit 83e6c06

Browse files
committed
Render components that returns null
1 parent 88bfbee commit 83e6c06

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

src/extendReactClass.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* eslint-disable react/prop-types */
22

3-
import React from 'react';
43
import _ from 'lodash';
54
import hoistNonReactStatics from 'hoist-non-react-statics';
65
import linkClass from './linkClass';
@@ -49,7 +48,7 @@ export default (Component: Object, defaultStyles: Object, options: Object) => {
4948
return linkClass(renderResult, styles, options);
5049
}
5150

52-
return React.createElement('noscript');
51+
return null;
5352
}
5453
};
5554

src/wrapStatelessFunction.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* eslint-disable react/prop-types */
22

33
import _ from 'lodash';
4-
import React from 'react';
54
import linkClass from './linkClass';
65

76
/**
@@ -39,7 +38,7 @@ export default (Component: Function, defaultStyles: Object, options: Object): Fu
3938
return linkClass(renderResult, styles, options);
4039
}
4140

42-
return React.createElement('noscript');
41+
return null;
4342
};
4443

4544
_.assign(WrappedComponent, Component);

tests/extendReactClass.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ describe('extendReactClass', () => {
128128
});
129129
});
130130
context('rendering Component that returns null', () => {
131-
it('generates <noscript> element', () => {
131+
it('generates null', () => {
132132
let Component;
133133

134134
const shallowRenderer = TestUtils.createRenderer();
@@ -145,7 +145,7 @@ describe('extendReactClass', () => {
145145

146146
const component = shallowRenderer.getRenderOutput();
147147

148-
expect(component.type).to.equal('noscript');
148+
expect(component).to.equal(null);
149149
});
150150
});
151151
context('target component have static properties', () => {

tests/wrapStatelessFunction.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe('wrapStatelessFunction', () => {
7575
});
7676
});
7777
context('rendering Component that returns null', () => {
78-
it('generates <noscript> element', () => {
78+
it('generates null', () => {
7979
const shallowRenderer = TestUtils.createRenderer();
8080

8181
const Component = wrapStatelessFunction(() => {
@@ -86,7 +86,7 @@ describe('wrapStatelessFunction', () => {
8686

8787
const component = shallowRenderer.getRenderOutput();
8888

89-
expect(component.type).to.equal('noscript');
89+
expect(component).to.equal(null);
9090
});
9191
});
9292
});

0 commit comments

Comments
 (0)