react属性

零:属性 props

属性:是不能被修改的,是由父组件传入的。

 一:写法1:<hello name=    ?    >    

         "name1"

          {123}

         {"name1"}

          {1,2,3}

         {variable} 

写法2:var props={

    one:"123",

    two:321

    }  

    <hello {...props}/> 直接添加one two属性

    <hello {props}/> 得到props对象

写法3:var instance=React .render(<hello></hello>,document.body);

    instance.setProps("name","Tim");

posted @ 2017-08-14 03:44  陈婉君  阅读(105)  评论(0编辑  收藏  举报