ReactJs 小记

引入文件有

react.min.js

eact-dom.min.js

browser.min.js


helloWord如下:

React 的 JSX 里约定分别使用首字母大、小写来区分本地组件的类和 HTML 标签。

<body>
    <div id="example"></div>
    <script type="text/babel" src="src/helloworld.js"></script>
</body>

注:js文件类型必须为label

<strong>var CommentBox = React.createClass({
  render: function() {
    return (
      <div className="commentBox">
        <h2>Hello, world! I am a CommentBox.<h2>
      </div>
    );
  }
});
ReactDOM.render(
  <CommentBox />,
  document.getElementById(</strong>example<strong>)
);</strong>

注:

1、组件开头CommentBox )必须为大写,

2、render里面的原生html元素必须小写,

3、使用原生class属性必须写为className

4、render只能渲染一个层,即如果render里面包含多个并列的div,则所有元素必须包含在一个父div里(即不能是多个div,所有div的必须包括在一个块里,刚开始这个困扰很久)


UI组件使用

REACT UI
https://github.com/Lobos/react-ui/   组件地址
http://lobos.github.io/react-ui/0.6/   说明文档

映入文件为

Form.js

ReactUI.js

使用方法:ReactUI.+组件名称  如(<ReactUI.Table ref = "row"></ReactUI.Table>)




你可能感兴趣的:(ReactJs 小记)