Skip to content

Commit 526521f

Browse files
use return statement with declared class
1 parent f24a987 commit 526521f

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/Coroutine.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import invariant from 'invariant';
55
function create(asyncFn, defaultVariables = () => ({})) {
66
const componentName = asyncFn.name || asyncFn.displayName;
77

8-
class AsyncComponent extends Component {
8+
return class AsyncComponent extends Component {
99
static get displayName() {
1010
return `Coroutine(${componentName})`;
1111
}
@@ -41,8 +41,6 @@ function create(asyncFn, defaultVariables = () => ({})) {
4141
return this.state.body;
4242
}
4343
}
44-
45-
return AsyncComponent;
4644
}
4745

4846
export default { create };

tests/Coroutine.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ describe('Coroutine', async () => {
77
async function render() {
88
return <p>test</p>;
99
}
10+
1011
const TestComponent = Coroutine.create(render);
1112
const tree = Renderer.create(<TestComponent />);
1213

@@ -20,7 +21,7 @@ describe('Coroutine', async () => {
2021
it('should pass initial information', async () => {
2122
function getVariables() {
2223
return { number: 13 };
23-
};
24+
}
2425

2526
async function render({ number }) {
2627
return <p>{ number }</p>;

0 commit comments

Comments
 (0)