user image

Jo Micheal
Published in : 2022-03-13

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 Date : 2022-03-13

Best answers

46

Best answers

46

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

Jo Micheal Date : 2022-03-13

Thanks, this was a mistake :)

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

How to update React router without Re-render?
Publish date: 2021-11-22 | Comments: 2

Tag: React js

Reload browser window using Reactjs?
Publish date: 2022-02-08 | Comments: 4

Tag: React js

[Solved] Cannot read properties of null (reading 'getBoundingClientRect')
Publish date: 2021-12-02 | Comments: 2

Tag: React js

React usestate array map() is not working
Publish date: 2022-04-22 | Comments: 3

Tag: React js

useStyles Invalid hook call class component
Publish date: 2022-02-10 | Comments: 2

Tag: React js

Best way to update the state in one class component from the redux store?
Publish date: 2022-03-30 | Comments: 3

Tag: React js

Warning: React.jsx: type is invalid
Publish date: 2022-05-06 | Comments: 1

Tag: React js