user

Jo Micheal

13 Mar 2022

TypeError: Super expression must either be null or a function

React js

I am facing this error when I try to run my Reactjs Component, I reviewed my code a lot of times but I cannot see any reason why this error is happening? the error is 

TypeError: Super expression must either be null or a function

my component is 

import React from 'react';
import Page from 'src/components/Page';
import {
 Container,
 Box,
 withStyles
} from '@material-ui/core';
import Header from './Header';
import { withRouter } from 'react-router';

const style = (() => ({
 root:{

 }
 
}));

class BanksList extends React.component {

 render(){
 return (
 <Page title="Banks">
 <Container maxWidth="lg">
 <Header />
 </Container>
 </Page>
 );
 }
}
export default withStyles(style)(withRouter(BanksList));

any thoughts?

Comments

Mohamed Atef

13 Mar 2022

Best Answer

best answer
githubgithubgithub

Hello Jo, 
This error happens because you have a mistake in the typo of the component in the line of 

class BanksList extends React.component {

}

it should be Component with capital C

class BanksList extends React.Component {

}

this gonna work with you, Good luck

Replies

Jo Micheal

13 Mar 2022

Thanks, this was a mistake :)

© 2024 Copyrights reserved for web-brackets.com