I want to learn the basics, so I want to move without JSX first, and when I use React.DOM.div
, I get the following error:
build.js:20123 Uncaught TypeError: Cannot read property 'div' of undefined
const React=require('react');
// approximately
const HelloWorld=createReactClass({
render: function() {
return React.DOM.div({},
'Hello World'+
this.props.name);
}
});
// approximately
"dependencies": {
"create-react-class": "^15.6.3",
"react": "^16.3.0",
"react-dom": "^16.3.0"
}
You can run React alone and React+JSX on a directly specified CDN of the HTML script tag.
This is my own technique page.
How to write JSX understand in React.js HelloWorld (beginning) - Qiita
Thank you for your cooperation.
javascript reactjs
React.DOM
was announced to be decommissioned in React 15.x and was actually decommissioned in 16.0.
If you want to continue using the same API, the package react-dom-factories
is available.
Currently, the official documentation introduces the use of React.createElement
.
© 2024 OneMinuteCode. All rights reserved.