Reputation: 65
I have created a react app through this command npx create-react-app myApp
. I want to create a class inside App.js
that extends React.Component
. The problem is I am not able to fire up the app because the browser shows this error:
Error
is there anything wrogn with creating classes in App.js
?
Here is my code of App.js
import React from 'react';
import logo from './logo.svg';
import './App.css';
class App extends React.Component() {
render(){
return (
<div>
Hello!
</div>
)
}
}
export default App;
Upvotes: 0
Views: 1338
Reputation: 4451
Looks like a typo. Change to:
class App extends React.Component {
You seem to have React.Component()
Upvotes: 2