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

51

Best answers

51

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

[solved] Version code 1 has already been used React native
Publish date: 2023-03-13 | Comments: 1

Tag: React js

[solved] Expected a conditional expression and instead saw an assignment
Publish date: 2021-11-29 | Comments: 0

Tag: React js

How to use Datepick of Mui with Formik
Publish date: 2022-02-14 | Comments: 7

Tag: React js

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

Tag: React js

React Component setState doesn't update my property
Publish date: 2022-03-29 | Comments: 2

Tag: React js