Reputation: 49
sday.js
import React from 'react';
const sday= React.createClass({
render( ){
return (
<div>hello world</div>
);
}
})
export default sday;
index.js
import React from 'react';
import ReactDOM from 'react-dom';
import registerServiceWorker from './registerServiceWorker';
import './index.css';
import App from './App';
import {sday} from './Component/example';
window.React= React;
ReactDOM.render(<sday/> , document.getElementById('root'));
registerServiceWorker();
I am trying to render sday
but I am getting an error of create class is not a function:
TypeError: __WEBPACK_IMPORTED_MODULE_0_react___default.a.createClass is not a function
Upvotes: 2
Views: 2167
Reputation: 112787
createClass
got removed in React 16, which is why you get the error.
If you would still like to use createClass
, you can use the standalone create-react-class package.
Upvotes: 5