import React,{Component} from 'react' import { inject, observer } from 'mobx-react' @inject('i18n') @inject('UserContext') @observer export default class Lang extends Component{ componentWillMount() { this.props.i18n.lang = this.props.lang == 'cn'? 'cn' : 'en' this.props.i18n.langInit = true } componentWillReceiveProps(nextProps) { // this.props.i18n.lang = nextProps.lang == 'cn'? 'cn' : 'en' // this.props.i18n.langInit = true if(this.props.i18n.lang != nextProps.lang) { window.location.reload() } } render(){ return <React.Fragment> { this.props.children } </React.Fragment> } }