简体   繁体   中英

I am writing code of following but show blank page

我正在编写以下代码,但显示空白页。

var hello = React.createClass({render : function(){return  <div><h1> Hi<h1/</div>;}});React.render(new hello(),document.body);
  1. Hi is undefined
  2. React.render accepts a React component, not a new() object
  3. Unless you are in older versions of React, you should use ReactDOM to render
  4. With React, it is not recommended to render directly to document.body

However this should help you get going:

var Hello = React.createClass({
  render: function(){
    return <p>Hi</p> ;
  }   
});
React.render(<Hello />, document.body);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM