8 开始研究react

25号之前一直忙tape out,最近有点时间准备开始看react了,其实bootstrap js 都没有研究很透,不过根据之前做IC的经验来看,这种工程类的事情向来就是先搭框架回去补细节比循规蹈矩效率高的,很多事情都是如此,所以考四六级什么的最好别等背完单词再去,不过GRE除外。

React没找到太多中文的,只能看英文的了,主要还是官网的材料。

在做那个tutorial。

除了官网的:http://reactjs.cn/react/docs/tutorial.html

还有中文的:

http://www.ruanyifeng.com/blog/2015/03/react

翻译自官网的:

http://wiki.jikexueyuan.com/project/react/tutorial.html

 

1.

// tutorial4.js
var Comment = React.createClass({
  render: function() {
    return (
      <div className="comment">
        <h2 className="commentAuthor">
          {this.props.author}
        </h2>
        {this.props.children}
      </div>
    );
  }
});


// tutorial5.js
var CommentList = React.createClass({
  render: function() {
    return (
      <div className="commentList">
        <Comment author="Pete Hunt">This is one comment</Comment>
        <Comment author="Jordan Walke">This is *another* comment</Comment>
      </div>
    );
  }
});

这个红色部分:  

官网: We access named attributes passed to the component as keys on this.props and any nested elements asthis.props.children.

卢老师的:this.props 对象的属性与组件的属性一一对应,但是有一个例外,就是 this.props.children 属性。它表示组件的所有子节点。

其实在这里就是 This is one comment 这句话,当然如果在里面加别的,比如div 什么的 同样都是 children

 

2.

tutorial11 官网和中午不是很一样

3.

ajax 部分参考这个:

http://api.jquery.com/jquery.ajax/

http://www.w3school.com.cn/jquery/ajax_ajax.asp

posted @ 2016-08-29 15:20  IC转行者兔子  阅读(130)  评论(0编辑  收藏  举报