0
votes

I tried with simple function and class components. The function component part working fine after include in my app.js. but I include class component it shows 'typeError: Class extends value undefined is not a constructor or null in react', how can I fix this issue ? I missed any configuration?

welcome.js

import React ,{ Componet  } from 'react'

class Welcome extends Componet{
    render(){
        return <h1> class component welcome </h1>
    }
}

export default Welcome

app.js

import React, {Component} from 'react'

import './App.css';

import Greet from './components/Greet'

import Welcome from './components/Welcome';

function App() {
  return (
    <div className="App">
      <Greet/>
      <Welcome/>
    </div>
  );
}
export default App;

react version

 npm view react version
    17.0.1
    npm view react-native version
    0.63.4
    npm view react-scripts version
    4.0.2
     npm view react-dom version
    17.0.1
1
typo in Component name in welcome.js "import React ,{ Componet } from 'react'" - GowriPranithBayyana

1 Answers

1
votes

You have a typo Componet, but should be Component in

class Welcome extends Componet{