How to use translation with component to make it useful for unit testing
问题 Most of the components looks like as follows: import React, { Component } from "react"; import { withTranslation } from "react-i18next"; class XYZ extends Component { constructor(props) { super(props); this.state = { }; } ..... ..... render() { const { t } = this.props; return ( ..... ); } } export default withTranslation()(XYZ); or, like below, in case of function components: export const XYZ = withTranslation()(({ t, ...props }) => { .... return ( ..... ); }); I wanted to use enzyme shallow