the project uses create-react-app scaffolding to frame the project. I just want to practice simply, but I didn"t expect to report an error. The code is as follows:
import React from "react";
import ReactDOM from" react-dom";
import". / index.css";
/ / import App from". / App";
import registerServiceWorker from". / registerServiceWorker";
var Card = React.createClass ({
)render: function() {
return (
<div>123
</div>
)
}
});
ReactDOM.render (< Card / >, document.getElementById ("root"));
registerServiceWorker ();
errors are as follows:
TypeError: _ WEBPACK_IMPORTED_MODULE_0_react_default.a.createClass is not a function
. / src/index.js
C:/Users/MatCloud/Desktop/mutest/test-react/src/index.js:7
4 | / / import App from". / App";
5 | import registerServiceWorker from". / registerServiceWorker";
6 |
7 | var Card = React.createClass ({
8 | render: function () {
9 | return (
10 |123
< / div >
View compiled
render: function () 6 stack frames were collapsed.Mar.03,2021