Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

308
Views
React Extending a class I get "classCallCheck.js:3 Uncaught TypeError: Cannot call a class as a function"

I found many questions and answers for this but I believe mine's slightly different. All I want to do is use the Base Class A functionality in the inherited child Class B, but I want to use a different functionality for the method Cell. With older Webpack versions, it worked fine, but the newer versions of Webpack rises an "Uncaught TypeError: Cannot call a class as a function". The code of Webpack catches the error is

export default function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

I read that it has to do with the class instance and using a new keyword is the way to make it work. In my case, using the last solution, I lose all the functionality of the Base Class A creating new types of errors because Base Class is already used as an instance from the other parts of the applications and it keeps its own states. I tried from example code like this

const C = new B() and return (<C param1={x}>); but it didn't work either. Any recommendations?

Here is a simplified version of my code.

/****************BASE CLASS********************************/
const A = (props) => {
    const Cell = ({ p: row }) => {
        return ..........
    };

}
export default A;

/*************CHILD CLASS**********************************/

import { B } from 'baseClass';
export default class B extends A {

   Cell = ({ p: row }) => {
       return ..........
   };

}
/*************MAIN**********************************/

import React, { Component } from 'react';
import B from 'childClass';

const List = class extends Component {
    render() { 

      return (<B param1={x}>);
    }
};
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!