[Solved] Uncaught TypeError: Super expression must either be null or a function, not undefined - React JS
As older than 0.13.0 version of React Js does not support ES6 style classes, If you want to use ES6 style classes in React older version than 0.13.0, you may face an error which says, "Uncaught TypeError: Super expression must either be null or a function, not undefined." From React Js official blog post, they state that React Js only supported ES6 style classes since version 0.13.0.
So if you want to use ES6 style classes in your react js app, you have to update your react version to 0.13.0 or more.
To update React Js version, you have to run the following command.
Install globally:
sudo npm install -g react@version (e.g. 0.13.2)
or you can install it locally by running
npm install react@0.13.2
Also, you have to make sure your browser is running in the correct version. Update your browser script as follow
<script type="text/javascript" src="react-0.13.2.js"></script>
After Updating the React Js version, if you face the same error again or an error that says "TypeError: Class extends value undefined is not a constructor or null." You have to make sure you are extending correct named classes. For example,
class ABC extends React.Component.
Not React.component, React.components, React.Components or React.createComponent.