“Uncaught TypeError: Super expression must either be null or a function” - based on my code, why am I getting this error?

“Uncaught TypeError: Super expression must either be null or a function” - based on my code, why am I getting this error?

I'm trying to setup a modal with React. I'm using code that is more or less taken from their docs. I'm not sure why I'm getting this error: "Uncaught TypeError: Super expression must either be null or a function." I've poked around and I've noticed this error usually appears when people forget to capitalize "Component" when setting up a class - class Modal extends React.Component - but that doesn't appear to be my problem.

I'm trying to setup a modal with React. I'm using code that is more or less taken from their docs. I'm not sure why I'm getting this error: "Uncaught TypeError: Super expression must either be null or a function." I've poked around and I've noticed this error usually appears when people forget to capitalize "Component" when setting up a class - class Modal extends React.Component - but that doesn't appear to be my problem.

I have React 16.6 and React-dom 16.6 as dependencies. Perhaps I don't have the most updated version of React and it's causing issues? Perhaps there is something else going on in my other files that reference this Modal that is causing the problem? Either way, I don't have a clear path to fixing this error because I don't know what is wrong, based on the error messaging in Chrome dev tools. My terminal isn't providing any error messaging either. I'm lost.

import React from "react";
import { createPortal } from "react-dom";

const modalRoot = document.getElementById("modal");

class Modal extends React.Compoment { constructor(props) { super(props); this.el = document.createElement("div"); } componentDidMount() { modalRoot.appendChild(this.el); } componentWillUnmount() { modalRoot.removeChild(this.el); } render() { return createPortal(this.props.children, this.el); } }

export default Modal;

The Modal should automatically render as soon as the application is started in the browser (yes, I'm aware that Modals can be pretty annoying for users but I'm still trying to learn how to make one on React)

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Why ReactJS is better for Web Application Development?

Web Application Development is the point of contact for a business in today's digital era. It is important to choose the right platform for Web Application Development to build a high end Web

ReactJS Development Services | ReactJS Development Company - Chapter 247 Infotech

Chapter 247 Infotech is a leading ReactJS development company in India, USA, offering ReactJS development services at par to a spectrum of business domains from E-commerce, healthcare to Edutech at

Pagination in ReactJs

There are a lot of resourceful materials online that give good insights into pagination in ReactJs, as well as NPM packages you can easily use