componentWillMount和componentDidMount的区别

一、componentWillMount  将要装载,在render以前调用;react

      componentDidMount,(装载完成),在render以后调用浏览器

二、componentWillMount  每个组件render以前当即调用;服务器

      componentDidMount  render以后并不会当即调用,而是全部的子组件都render完以后才能够调用component

三、componentWillMount  能够在服务端被调用,也能够在浏览器端被调用;服务器端

      componentDidMount  只能在浏览器端被调用,在服务器端使用react的时候不会被调用服务端

相关文章
相关标签/搜索