Javascript 未捕获类型错误:超级表达式必须为null或函数,而不是react应用程序中未定义的错误

Javascript 未捕获类型错误:超级表达式必须为null或函数,而不是react应用程序中未定义的错误,javascript,reactjs,Javascript,Reactjs,package.json看起来像 { "name": "react_playlist", "version": "1.0.0", "description": "All the course files for the Net Ninja React tutorial playlist on YouTube", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" &am

package.json看起来像

{
  "name": "react_playlist",
  "version": "1.0.0",
  "description": "All the course files for the Net Ninja React tutorial playlist on YouTube",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "npm run build",
    "build": "webpack -d && webpack-dev-server --content-base src/ --inline --hot --port 1234"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/iamshaunjp/react-playlist.git"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/iamshaunjp/react-playlist/issues"
  },
  "homepage": "https://github.com/iamshaunjp/react-playlist#readme",
  "dependencies": {
    "react": "^15.6.1",
    "react-dom": "^15.6.1"
  },
  "devDependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "webpack": "^3.5.5",
    "webpack-dev-server": "^2.7.1"
  }
}
错误看起来像

{
  "name": "react_playlist",
  "version": "1.0.0",
  "description": "All the course files for the Net Ninja React tutorial playlist on YouTube",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "npm run build",
    "build": "webpack -d && webpack-dev-server --content-base src/ --inline --hot --port 1234"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/iamshaunjp/react-playlist.git"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/iamshaunjp/react-playlist/issues"
  },
  "homepage": "https://github.com/iamshaunjp/react-playlist#readme",
  "dependencies": {
    "react": "^15.6.1",
    "react-dom": "^15.6.1"
  },
  "devDependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "webpack": "^3.5.5",
    "webpack-dev-server": "^2.7.1"
  }
}
bundle.js:20087未捕获类型错误:超级表达式必须为
null或函数,未定义
at_继承(bundle.js:20087)
在bundle.js:20090
反对。(bundle.js:20115)
网页上需要(bundle.js:677)
在fn(bundle.js:88)
反对。(bundle.js:14155)
网页上需要(bundle.js:677)
位于module.exports(bundle.js:723)
在bundle.js:726

这是我的index.html

 <!DOCTYPE html>
    <html>
        <head>
              <title>React</title>
        </head>

        <body>
      <div id="xyz"></div>
          <script src = "/app/bundle.js"></script>

        </body>
    </html>

反应
这是我的index.js

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

class App extends React.component{

  render(){

    return (
      <div>
      <h1>all good</h1>
      </div>
    )
  }
}


ReactDom.render(<App />,document.getElementById('xyz'));
从“React”导入React;
从“react dom”导入react dom;
类App扩展了React.component{
render(){
返回(
一切都好
)
}
}
ReactDom.render(,document.getElementById('xyz'));

这是因为您使用了
React.component
而不是
React.component
的大写字母
C
(@ShubhamKhatri)

另外,
ReactDom
应该与导入中的大小写匹配,因此它应该是
ReactDom
(@AndreaFalzetti)

这是您的问题:

类应用程序扩展React.component{
render(){
返回(
一切都好
)
}
}
ReactDOM.render(,document.getElementById('xyz'))

这是因为您使用了
React.component
而不是
React.component
的大写字母
C
(@ShubhamKhatri)

另外,
ReactDom
应该与导入中的大小写匹配,因此它应该是
ReactDom
(@AndreaFalzetti)

这是您的问题:

类应用程序扩展React.component{
render(){
返回(
一切都好
)
}
}
ReactDOM.render(,document.getElementById('xyz'))


有一个输入错误,它应该是
React。组件
大写
C
看到这个问题了吗?因为扩展类@ShubhamKhatri时出错了,我相信你也在
ReactDom.render
函数中添加了
,而原来它不在那里。还有,
ReactDom
应该是您导入的
ReactDom
。@NimrodArgov,我只是格式化了代码,没有添加任何内容。有输入错误,它应该是
React.Component
和大写的
C
看到这个问题了吗?因为在扩展@ShubhamKhatri类时出错了,我相信你也在
ReactDom.render
函数中添加了
,而原来它不在那里。还有,根据您的导入,
ReactDom
应该是
ReactDom
。@NimrodArgov,我只是格式化了代码,没有添加任何内容