加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

react学习笔记

发布时间:2020-12-15 05:20:58 所属栏目:百科 来源:网络整理
导读:1.如何创建组件: React.createClass({ getInitialState: function () { return {} // 返回state },render: function () { return div / div } }) 2.组件中得属性: this.state:getInitialState返回的 this.props:标签里面的属性 3.组件的生命周期: 装载

1.如何创建组件:

React.createClass({
    getInitialState: function () {
        return {} // 返回state
    },render: function () {return <div></div>} })

2.组件中得属性:

this.state:getInitialState返回的
this.props:标签里面的属性

3.组件的生命周期:

装载组件触发:

  • componentWillMount

只会在装载之前调用一次,在 render 之前调用

  • componentDidMount

只会在装载完成之后调用一次,在 render 之后调用

更新组件触发:

componentWillRecevieProps
shouldComponentUpdate
componentWillUpdate
componentDidUpdate

卸载组件触发:

componentWillUnmount

4.使用webpack打包react

github地址

5.react-native

教程
https://devdactic.com/react-native-firebase-todo/

6.有用文章

已买到的宝贝前端组件化探索
http://taobaofed.org/blog/2015/11/02/buy-component/
React Native实战 by 鬼道@天猫
http://airjd.com/view/iap1mz440004r90#33


参考资料:
React 入门教程 https://hulufei.gitbooks.io/react-tutorial/content/introduction.html
深入浅出React http://www.infoq.com/cn/articles/react-art-of-simplity

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读