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

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

Tag: React js

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

Tag: React js

[solved] Render/Show a custom option in Autocomplete Material UI?
Publish date: 2021-12-22 | Comments: 2

Tag: React js

TypeError: Cannot read properties of null (reading 'scrollTop') in jest
Publish date: 2022-09-08 | Comments: 1

Tag: React js

How to use SetFieldValue from outside render function? Formik
Publish date: 2021-07-03 | Comments: 2

Tag: React js