简体   繁体   English

Reactjs错误:babel-runtime.js:32 Uncaught TypeError:超级表达式必须为null或函数,而不是未定义

[英]Reactjs error: babel-runtime.js:32 Uncaught TypeError: Super expression must either be null or a function, not undefined

I am brand new to reactjs, and I am using it in a meteor project I am trying to learn. 我是reactjs的新手,我正在尝试学习的流星项目中使用它。 Here is the code to help =]: 这是帮助=]的代码:

import ReactDOM from 'react-dom';

class App extends ReactDOM.Component {
  render(){
    return (
      <h1>Hello World!</h1>
    )
  }
}

if(Meteor.isClient) {
  Meteor.startup(function(){
    ReactDOM.render(<App />, document.getElementById("render-target"));
  });
}

react and react-dom are different modules. reactreact-dom是不同的模块。 It's the react module that has Component defined. 它是具有Component定义的react模块。 So change to this: 所以改为:

import React from 'react';
import ReactDOM from 'react-dom';

class App extends React.Component {
  render(){
    return (
      <h1>Hello World!</h1>
    )
  }
}

if(Meteor.isClient) {
  Meteor.startup(function(){
    ReactDOM.render(<App />, document.getElementById("render-target"));
  });
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 babel 或 webpack 或我的代码导致此错误“未捕获的类型错误:超级表达式必须是 null 或函数” - either babel or webpack or my code are causing this error "Uncaught TypeError: Super expression must either be null or a function" webpack、react 和 babel:未捕获的类型错误:超级表达式必须为 null 或函数,而不是未定义 - webpack, react and babel: Uncaught TypeError: Super expression must either be null or a function, not undefined 未捕获的TypeError:超级表达式必须为null或函数,且未定义(React.js,Flux,ES6) - Uncaught TypeError: Super expression must either be null or a function, not undefined (React.js, Flux, ES6) Uncaught TypeError:超级表达式必须为null或函数,而不是react app中的未定义错误 - Uncaught TypeError: Super expression must either be null or a function, not undefined error in react app 使用webpack的react-redux给出错误Uncaught TypeError:超级表达式必须为null或函数,且未定义 - react-redux with webpack giving error Uncaught TypeError: Super expression must either be null or a function, not undefined 文本框未捕获的TypeError:超级表达式必须为null或函数,且未定义 - text box Uncaught TypeError: Super expression must either be null or a function, not undefined 超级表达式必须为null或函数,而不是undefined - reactjs - Super expression must either be null or a function, not undefined - reactjs ReactJS - 超级表达式必须为空或函数,而不是未定义 - ReactJS - Super expression must either be null or a function, not undefined React JS路由不起作用(未捕获的TypeError:超级表达式必须为null或函数,而不是对象) - React JS routing not working (Uncaught TypeError: Super expression must either be null or a function, not object) Traceur运行时:超级表达式必须为null或函数,而不是未定义 - Traceur runtime: Super expression must either be null or a function, not undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM