We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c0409ce commit 9820e05Copy full SHA for 9820e05
1 file changed
setupJest.js
@@ -44,10 +44,12 @@ jest.mock('react-i18next', () => ({
44
type: '3rdParty',
45
},
46
// this mock makes sure any components using the translate HoC receive the t function as a prop
47
- withTranslation: () => (Component) => {
48
- Component.defaultProps = { // eslint-disable-line no-param-reassign
49
- ...Component.defaultProps, t: k => k,
50
- };
51
- return Component;
+ withTranslation: () => (WrappedComponent) => {
+ /**
+ *
+ */
+ const I18nAwareComponent = ({ t = (k => k), ...props }) => <WrappedComponent t={t} {...props} />; // eslint-disable-line react/prop-types
52
+
53
+ return I18nAwareComponent;
54
55
}));
0 commit comments