Previously I was using reactjs 0.12.1, but for my latest project I updated to the latest 0.13
This has resulted in an error I didn't get before:
Warning: Something is calling a React component directly.
Use a factory or JSX instead.
See: http://ift.tt/1HOmxEW
TypeError: Cannot read property '__reactAutoBindMap' of undefined
I put together a very simple example to see if I could work out whats going on.
I looked at the link provided in the warning, but I am still fairly new to react and I am having trouble working out what I need to change when I am using JSX.
I also saw this question, but it deals only with react without JSX
Could someone tell me where I am going wrong / what I need to do to get rid of this error in reactjs 0.13.1?
Here is my sample component:
components.react.js
var React = require('react');
var HelloMessage = React.createClass({
render: function() {
return <div>Hello {this.props.name}</div>;
}
});
module.exports = HelloMessage;
app.js
var React = require('react');
var HelloMessage = require('./components.react');
React.render(
<HelloMessage name="John" />,
document.body
);
I am also using node-jsx in my server js:
var JSX = require('node-jsx').install();
I also checked the version of node-jsx as this question suggested there might be a problem with later versions, but my node-jsx is up-to-date 0.12.4.
Aucun commentaire:
Enregistrer un commentaire