I just dropped the interop example into a create-react-app reason script boilerplate and im getting “TypeError: React.createClass is not a function” Any idea why that is? https://github.com/idkjs/notafunction/tree/master/src Thanks for any guidance.
TypeError: React.createClass is not a function
thangngoc89
#2
Lastest version of React (16.x) separated createClass to a package named https://www.npmjs.com/package/create-react-class
You can learn more here https://reactjs.org/docs/react-without-es6.html
chenglou
#3
Eh we vendor our own createClass function and don’t use a third-party one. Is reason-scripts different?
idkjs
#4
@chenglou not following exactly but the demo repo throws that error. Should it not?
How would we deal with that if its a different version of createClass?
keira
#6
It looks like you’re using an older version of the demo repo?
If you update MyBanner.js to the new version it should work fine.
var ReactDOM = require('react-dom');
var React = require('react');
var App = function(props) {
if (props.show) {
return React.createElement('div', null,
'Here\'s the message from the owner: ' + props.message
);
} else {
return null;
}
};
App.displayName = "MyBanner";
module.exports = App;
thangngoc89
#7
@idkjs you’re simply accessing React.createClass which is unavailable in latest React.js distribution, use create-react-class
instead.