Skip to content

Commit

Permalink
Fix the displayName of HOC components
Browse files Browse the repository at this point in the history
  • Loading branch information
SimeonC committed Mar 22, 2019
1 parent 61c4645 commit d9fc0fb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -25,7 +25,8 @@
},
"dependencies": {
"@babel/runtime": "^7.3.1",
"html-parse-stringify2": "2.0.1"
"html-parse-stringify2": "2.0.1",
"react-display-name": "^0.2.4"
},
"devDependencies": {
"@babel/cli": "^7.2.3",
Expand Down
1 change: 1 addition & 0 deletions src/withSSR.js
Expand Up @@ -13,6 +13,7 @@ export function withSSR() {
}

I18nextWithSSR.getInitialProps = composeInitialProps(WrappedComponent);
I18nextWithSSR.displayName = `withI18nextSSR(${getDisplayName(WrappedComponent)})`;

return I18nextWithSSR;
};
Expand Down
5 changes: 5 additions & 0 deletions src/withTranslation.js
@@ -1,4 +1,5 @@
import React from 'react';
import getDisplayName from 'react-display-name';
import { useTranslation } from './useTranslation';

export function withTranslation(ns) {
Expand All @@ -14,6 +15,10 @@ export function withTranslation(ns) {
});
}

I18nextWithTranslation.displayName = `withI18nextTranslation(${getDisplayName(
WrappedComponent,
)})`;

return I18nextWithTranslation;
};
}

0 comments on commit d9fc0fb

Please sign in to comment.