初识react
2016-02-29 10:08
633 查看
react 被称为颠覆式前端开发
react不是一个完整的mvc,并认为mvc并不适应所有开发场景
官网:
1.
<script type="text/jsx">
注:其中的<div>并不是dom节点,而是react divcomponent的一个实例
2.class在js语言的 标准是一个关键字,不能直接在react的标签中是用class,改用classname
3.内联样式的stylecss注意,写作style={{color:'red'}}
实质为:
var styleObj={color:'red'};
style={styleObj}
4.React Components Lifecycle
Mounted:render解析生成dom的过程
update:mounted components被重新render的过程
unmounted:mounted Components对应的Dom节点被从dom结构中移除的过程。
注:每个状态react都封装了对应的hook函数
5.各阶段函数
Mounting: getInitialState()
componentWillMount()
render()
componentDidMount()
Updating: componentWillReceiveProps()
shouldComponentUpdate()
componentWillUpdate()
render()
componentDidUpdate()
Unmounting: componentWillUnmount()
6.state私有,props属于被调用方
7.setTimeout函数中this表示运行环境(全局对象global,即windows),不表示调用函数的对象
8.react事件监听处理
react不是一个完整的mvc,并认为mvc并不适应所有开发场景
官网:
http://facebook.github.io/react/index.html
1.
<script type="text/jsx">
<strong>var Hello=React.createClass( render:function(){ return <div>Hello {this.props.name}</div> }); React.render(<hello name="World"/>,document.getElementById('container'));</strong>
注:其中的<div>并不是dom节点,而是react divcomponent的一个实例
2.class在js语言的 标准是一个关键字,不能直接在react的标签中是用class,改用classname
3.内联样式的stylecss注意,写作style={{color:'red'}}
实质为:
var styleObj={color:'red'};
style={styleObj}
4.React Components Lifecycle
Mounted:render解析生成dom的过程
update:mounted components被重新render的过程
unmounted:mounted Components对应的Dom节点被从dom结构中移除的过程。
注:每个状态react都封装了对应的hook函数
5.各阶段函数
Mounting: getInitialState()
componentWillMount()
render()
componentDidMount()
Updating: componentWillReceiveProps()
shouldComponentUpdate()
componentWillUpdate()
render()
componentDidUpdate()
Unmounting: componentWillUnmount()
6.state私有,props属于被调用方
7.setTimeout函数中this表示运行环境(全局对象global,即windows),不表示调用函数的对象
8.react事件监听处理
相关文章推荐
- React-事件处理详解
- React Native环境配置
- ReactiveCocoa的学习笔记
- ReactJS修炼之路(三):props vs state
- 如何创建一个android的react-native组件(二)
- ReactNative入门(安卓)——API(上)
- 如何配置React Native真机调试-iOS
- Reactor和Proactor
- React Native学习之TabBarIOS用法
- hello react.js
- [react-native开发中错误]SDK location not found. Define
- React-Native Windows完全安装指南
- ReactiveCocoa
- 用CocoaPods和ReactiveCocoa的安装
- ReactiveCocoa框架到底是多强大
- ReactJS
- 在ActionBar显示ShareActionProvider分享文本,点击可以打开进行分享(19)
- Relay: 全新的React数据获取框架
- [转]React官方学习笔记
- ReactiveCocoa 4 官方文档翻译