I am new to react-router (https://github.com/rackt/react-router). I included it after react like this:
I have encountered another scenario where this may occur.
I had v0.13.x
as a direct dependency, and one of my dependencies had v0.12.x
- so two copies of React were included in my bundle. This meant components using ES6 classes were attempting to extend
a non-existent React.Component
(they were getting the v0.12.x
of React).
I diagnosed this issue by looking how many copies of react were in my node_modules
:
npm ls | grep react@
Which gave me the following result:
├── react@0.13.3
│ └── react@0.12.2
The -C
option for grep
allows you to see surrounding lines, so I re-ran:
npm ls | grep react@0.12.2 -C 5
The surrounding text allowed me to identify the offending package.
I sloved the issue by upgrading react version to 0.13.3
npm install react@0.13.3
Though this has been resolved, I am posting a solution since I had a similar problem. Hopefully it will be helpful to someone else.
I wasn't using React Router. I was using React with Webpack, with Babel as loader. I was getting the same error as stated by JustWonder.
I was using ES6 classes. Turns out, I had typed
class App extends React.component {...}
Changing React.component
to React.Component
(upper-case 'C') solved the problem for me.