Ad

Issue With "TypeError: Class Extends Value Undefined Is Not A Constructor Or Null" In React Class

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;
Ad

Answer

Looks like a typo. Change to:

class App extends React.Component {

You seem to have React.Component()

Ad
source: stackoverflow.com
Ad