我正在开发一个获取api的应用程序,并使用ReactJS替换它,我的index.js文件是:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './components/App';
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render( < App /> , document.getElementById('root'));
registerServiceWorker();
错误是
TypeError:
Object(...)不是函数
模块../src/index.js
我该如何解决?谢谢!
我的App.js代码在这里
import React, {
Component
} from 'react';
import PokeList from './PokeList';
import './styles/App.css';
class App extends Component {
constructor() {
super();
this.state = {};
}
render() {
return ( <div className = "App" >
<PokeList />
</div>
);
}
}
export default App;
PokeList.js
import React from 'react';
import './styles/PokeList.css';
const PokeList = () => {
return ( <section className = "poke-list" >
</section>
)
}
export default PokeList;
答案 0 :(得分:0)
我认为您只需要升级即可做出反应> 16.8。在反应方面没有重大变化,因此您应该没事。