I am building a project in react and tried to change a functional component to class component in order to use this.state
etc... However, I am receiving an error Missing semicolon. (22.11)
. How can I fix this in order to continue my project?
This is my code:
import React from 'react'
import Navigation from './components/Navigation/Navigation'
import LogIn from './components/LogIn/LogIn'
import Converter from './components/Converter/Converter'
import './App.css'
import 'bootstrap/dist/css/bootstrap.min.css'
class App extends Component {
constructor() {
super();
this.state = {
}
}
}
render () {
return (
<div className='App'>
<Navigation />
<LogIn />
<Converter />
</div>
);
}
export default App
Line 22.11 is the render word!
CodePudding user response:
class App extends Component {
constructor() {
super();
this.state = {}
}
render () {
return (
<div className='App'>
<Navigation />
<LogIn />
<Converter />
</div>
);
}
}
export default App
CodePudding user response:
There are certain errors in code DEMO
class App extends Component {
constructor() {
super();
this.state = {
}
}
// } This is extra
render () {
return (
<div className='App'>
<Navigation />
<LogIn />
<Converter />
</div>
);
}
} // Add extra `}` to close class
export default App;