Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React TypeError: Class constructor Fullpage cannot be invoked without 'new'

When I use tag as shown below, I'm getting this error!

React TypeError: Class constructor Fullpage cannot be invoked without 'new'

It looks like something went wrong in line 1438: renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:14803 this is my Fullpage.js file:

 import React, {Component} from 'react';
    import './Fullpage.css'
    
    class Fullpage extends Comment{
        render(){
            const {children}=this.props
            return(
                <div className={`fullpage ${this.props.className || ''}`}>
                    {children}
                </div>
            );
        }
        
    }
    
    export default Fullpage

App.js file:

import React, { Component } from 'react'
import data from './data.json';
import logo from './logo.svg';
import './App.css';
import { SocialIcon } from 'react-social-icons';
import Fullpage from './components/Fullpage.js'

class App extends Component{
    render(){
        return(
          <div className="App container">
              <div className="navigation">
              </div>
              <Fullpage className="first">
                  <h1 className="title" id={"title"}>
                      {data.title}
                  </h1>
                  <div>
                      <h2>
                        {data.subtitle}
                      </h2>
                  </div>

                  <div className="icons-wrapper">
                      {
                          Object.keys(data.links).map(key=>{
                              return(
                                  <div className="icon">
                                  <SocialIcon url={data.links[key]}/>
                                  </div>
                              );
                          })
                      }
                  </div>
              </Fullpage>
              <div className="fullpage">
                  <h3>
                      {data.sections[0].title}
                  </h3>
                  <p>
                      {data.sections[0].items[0].content}
                  </p>
              </div>
              <div className="fullpage">
              </div>
          </div>
        );
    }
}
export default App;
like image 348
Atousa Avatar asked Oct 16 '25 16:10

Atousa


1 Answers

Looks like there should be: class Fullpage extends Component not Comment.

like image 180
Ramil Garipov Avatar answered Oct 18 '25 08:10

Ramil Garipov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!