我跟着这个:
https://www.codeandweb.com/babeledit/tutorials/how-to-translate-your-react-app-with-react-i18next
但是,正如你所看到的,我必须这样做:
export default translate()(App);
但我已在我的组件中使用它:
export default withRouter(connect(null,mapDispatchToProps)(withStyles(styles)(SignIn)));
在这种情况下我该怎么办?
非常感谢。
你可以查看this答案,它回答了这个确切的问题。
长话短说,应该可以像这样进一步包装Higher Order Components (HOC):
export default withRouter(connect(null, mapDispatchToProps)(withStyles(styles)(translate()(SignIn))));
或者在上面链接的答案中使用recompose。