We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents cf39a4b + e25d0b9 commit d698fd2Copy full SHA for d698fd2
compat/src/memo.js
@@ -30,5 +30,6 @@ export function memo(c, comparer) {
30
Memoed.displayName = 'Memo(' + (c.displayName || c.name) + ')';
31
Memoed.prototype.isReactComponent = true;
32
Memoed._forwarded = true;
33
+ Memoed.type = c;
34
return Memoed;
35
}
compat/test/browser/memo.test.js
@@ -233,4 +233,13 @@ describe('memo()', () => {
233
`<ol><li>A</li><li>B</li><li class="selected">C</li><li>D</li></ol>`
234
);
235
});
236
+
237
+ it('should attach .type pointing to the original component', () => {
238
+ function Foo() {
239
+ return <div />;
240
+ }
241
+ const Memoized = memo(Foo);
242
243
+ expect(Memoized.type).to.equal(Foo);
244
+ });
245
0 commit comments