react更好的实现操作

1:使用v-text代替{{}}绑定元素内容,能够避免编译前的闪现问题
(使用{{}}在编译阶段,页面会显示{{msg}},然后闪现为对应的值)
v-text 作用是更新元素的textContent
2:v-html绑定元素上,也可以避免编译前闪现问题
作用于更新元素的innerHTML
3:方法顺序编写
static 方法
constructor()
getChildContext()
componentWillMount()
componentDidMount()
componentWillReceiveProps()
shouldComponentUpdate()
componentWillUpdate()
componentDidUpdate()
componentWillUnmount()
点击处理程序或事件处理程序,如 onClickSubmit() 或 onChangeDescription()
用于渲染的getter方法,如 getSelectReason() 或 getFooterContent()
可选的渲染方法,如 renderNavigation() 或 renderProfilePicture()
render()
不忘初心,不负梦想
原文地址:https://www.cnblogs.com/panrui1994/p/11832833.html