反应ES6 TypeError:instance.render不是一个函数

时间:2018-07-05 03:55:54

标签: ecmascript-6 react-dom

我错过了一个问题,但无法解决,您能帮我吗?谢谢!

警告:Wrap(...):在返回的组件实例上找不到render方法:您可能忘记了定义render

// alert('end')
// import 'babel-polyfill';
import dva from 'dva';
// import 'moment/locale/zh-cn';
import './g2';
import './rollbar';
// import browserHistory from 'history/createBrowserHistory';
import './index.less';
import router from './router';
import { routerRedux } from 'dva/router';
import createLoading from 'dva-loading';
import { LocaleProvider } from 'antd';
import { addLocaleData, IntlProvider } from 'react-intl';
import ReactDOM from 'react-dom';
import React from 'react';
import './config/config';
import { setAuthority, getAuthority } from './utils/authority';


// 设置全局的DOC地址 后期维护
window.DOC_HOST = 'https://bss.eliteu.cn/oss_media/'
// setAuthority('guest');
setAuthority(getAuthority());

const appLocale = window.appLocale;
addLocaleData(appLocale.data);


// window.onerror = function(){alert('11')}
// 1. Initialize
const app = dva({
  ...createLoading({
    effects: true,
  }),
  // history: browserHistory(),
});

// 2. Plugins
// app.use({});
// app.dipath

// 3. Register global model
app.model(require('./models/global').default);
// 4. Router
app.router(router);

// 5. Start
// app.start('#root');
const App = app.start();

//
class Wrap extends React.Component {
  constructor() {
    super();
    this.state = {
      locale: null,
    };
  }
  handelIntl= () => {
    this.setState({
      locale: window.appLocale.antd,
    })
  }
  render() {
    return (<LocaleProvider locale={appLocale.antd}>
      <IntlProvider locale={appLocale.locale} messages={appLocale.messages}>
        <App handelIntl={this.handelIntl} />
      </IntlProvider>
    </LocaleProvider>)
  }
}

ReactDOM.render(<Wrap />, document.getElementById('root'));

some image

another image

0 个答案:

没有答案