Reputation: 68
I'am newbie to react and just trying to learn about state and component but iam getting some errors plz can anyone help me out
my main app.js code is this
import React,{Component} from 'react';
import './App.css';
import Greet from './Comp'
class App extends Component {
render(){
return (
<div className='App'>
<Greet></Greet>
</div>
)
}
}
export default App;
and my comp.js code is this
import React,{Component} from 'react'
class Greet extends Component (){
constructor(props){
super(props)
this.state = {
message:'hello'
}
}
render(){
return (
<h1>hello {this.state.message}</h1>
)
}
}
export default Greet;
is their any problem with my webpack or my code?
Upvotes: 0
Views: 153
Reputation: 845
Remove the ()
from this line class Greet extends Component ()
, So it would be like class Greet extends Component
.
Upvotes: 3