2

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

user7637745
  • 965
  • 2
  • 14
  • 27

1 Answers1

5

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.

Tholle
  • 108,070
  • 19
  • 198
  • 189