import React, from 'react'
import { observer } from 'mobx-react'
@observer
class OrgsPage extends React.Component {
render = () =>
<div>Hello</div>
}
export default OrgsPage
When I try and use this as a component in React I get:
babel-runtime.js?hash=71fe7d0…:108 Uncaught TypeError: Cannot call a class as a function
at classCallCheck (http://localhost:4000/packages/babel-runtime.js?hash=71fe7d0d01dc808e2a80cb0a7958fb31e46323d5:108:13)
at Constructor.OrgsPage (http://localhost:4000/app/app.js?hash=7ba134c41c0997baa4644e0e7b2750d3c4341f2f:1794:37)
at Constructor.render (http://localhost:4000/packages/modules.js?hash=58c8b0b77d6bd50615c786bc9f20afd954ec52db:129542:32)
at Object.allowStateChanges (http://localhost:4000/packages/modules.js?hash=58c8b0b77d6bd50615c786bc9f20afd954ec52db:116825:15)
at Reaction.<anonymous> (http://localhost:4000/packages/modules.js?hash=58c8b0b77d6bd50615c786bc9f20afd954ec52db:129440:44)
...
This does not happen if I do any of the following:
Remove @observer
Change the render method to be a normal method (not a class property)
Have render as a normal method and add in another class property under a different name
This was working for me, and then updated some of my npm packages (like babel-preset-es2015) and then it stopped working. But npm being npm I can't see to get my node_modules back into that state again to prove it's a change between 6.16.0 and 6.18.0 of babel-preset-es2015.
I have the following code:
When I try and use this as a component in React I get:
This does not happen if I do any of the following:
@observer
render
method to be a normal method (not a class property)render
as a normal method and add in another class property under a different nameMy
.babelrc
:And (what I think is) relevant
package.json
:This was working for me, and then updated some of my npm packages (like
babel-preset-es2015
) and then it stopped working. But npm being npm I can't see to get my node_modules back into that state again to prove it's a change between 6.16.0 and 6.18.0 ofbabel-preset-es2015
.