先在在学习react,react是faceBook推出的框架,因为虚拟DOM使页面性能提高很大,特别react Native非常适合移动端,现做一个学习总结:
1.react 获取DOM的两种方式是ReactDOM.findDOMNode,this.refs.xxx。
例如:
let ele = findDOMNode(this.refs.content);
let ele2 = this.refs.content;
···················································································································
<div ref='content'>这是我DOM元素里面的内容</div>
···················································································································
控制器输出的内容就是 这是我DOM元素里面的内容,
在这里refs 是获取DOM元素的内容,ref是设定DOM的content的内容,两者不能搞反了,否则会报错ref is not defined