为什么我从代码库中收到此错误?

时间:2020-07-14 11:19:29

标签: reactjs

TypeError: class heritage react__WEBPACK_IMPORTED_MODULE_0__.component is not an object or null

来自此代码;

import React, {component} from 'react';
import Cardlist from './Cardlist';
import SearchBox from './SearchBox';
import {robots} from './robots';
class App extends  component{
constructor () {
  super()
  this.state = {
    robots: robots,
    searchfield: ''  
  }
  }
  render(){
    return (
        <div className = 'tc'>
        <h1>RoboFriends</h1>
        <SearchBox/>
        <Cardlist  robots = {this.state.robots}/>
         </div>
    );

    }  
 }

   export default App;

0 个答案:

没有答案