先在在学习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
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步