reactJS

作者: 小红猪大鼻孔 | 来源:发表于2018-08-05 18:23 被阅读0次

    1、script type = "type/babel"

    var ReactName = React.createClass({
      render: function(){
        return(
          <div></div>
        )
      }
    })
    

    2、渲染组件:只能有一个顶层标签。关键字使用className,不能使用class。定义组件名称首字母一定要大写。
    3、props&state

    getInitialState:function(){
        return {
          oneData: data
        }
     }
    

    setState(updater[,callback])是一个异步函数,可以在setState使用第二个param完成之后执行一个函数。例如:

    this.setState({
      someState: obj,
    }, () => {
      this.stateFinished();
    })
    

    onKeyUp: 鼠标抬起的时候回调的事件

    相关文章

      网友评论

          本文标题:reactJS

          本文链接:https://www.haomeiwen.com/subject/ongbvftx.html