![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
react
前端小泰迪
这个作者很懒,什么都没留下…
展开
-
react 初始化项目的两种方法
第一种安装脚手架npm install -g create-react-app创建项目create-react-app reactdemo启动项目cd reactdemonpm start 运行项目npm run build 生成项目第二种npx create-react-app reactdemo...原创 2018-12-27 09:46:57 · 3136 阅读 · 0 评论 -
react 执行函数 获取this指向
在事件上绑定this 从而改变this 指向<button onClick={this.getData.bind(this)}>点击</button>在构造函数里进行绑定thisconstructor(){ super(); this.state={ }; this.getData=this.getData.bind(this)}3.箭...原创 2018-12-27 12:03:52 · 1200 阅读 · 2 评论 -
react父子组件传值
父组件给子组件传值Home 为父组件 ,Children 为子组件值得注意的是,父组件不仅可以给子组件传值,还可以给子组件传方法,以及把整个父组件传给子组件。父组件调用子组件的方法//传值<Children msg="首页"></Children>//在子组件中this.props.msg 就可以拿到//方法与传值一样//传递整个父组件<Child...原创 2018-12-29 10:57:58 · 180 阅读 · 0 评论