Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 1c9cb76

Browse files
committed
Expose wrapped component
1 parent 9f246bc commit 1c9cb76

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/__tests__/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ describe('perf higher-order component', () => {
4040
expect(MyCompPerf.displayName).toContain(MyComp.name);
4141
});
4242

43+
it('expose wrapped component in WrappedComponent', () => {
44+
const MyComp = () => <div className="my-comp" />;
45+
const MyCompPerf = perf(MyComp);
46+
47+
expect(MyCompPerf.WrappedComponent).toBe(MyComp);
48+
});
49+
4350
it('starts ReactPerf on mount', () => {
4451
const MyComp = () => <div className="my-comp" />;
4552
const MyCompPerf = perf(MyComp);

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@ export default function perf(Target) {
4040
}
4141

4242
Perf.displayName = `perf(${Target.displayName || Target.name || 'Component'})`;
43+
Perf.WrappedComponent = Target;
4344
return Perf;
4445
}

0 commit comments

Comments
 (0)