为了账号安全,请及时绑定邮箱和手机立即绑定

按老师的顺序及语法编写了js文件,运行结果如下!!

https://img1.sycdn.imooc.com//5b4c5cec00011fde12030152.jpg

按老师的顺序及语法编写了js文件,运行结果如下!!


正在回答

2 回答

现在已经是异常渲染了

0 回复 有任何疑惑可以回复我~
/*** Sample React Native App* https://github.com/facebook/react-native* @flow*/import React, { Component } from 'react';import {Platform,StyleSheet,Text,View} from 'react-native';const instructions = Platform.select({ios: 'Press Cmd+R to reload,\n' +'Cmd+D or shake for dev menu',android: 'Double tap R on your keyboard to reload,\n' +'Shake or press menu button for dev menu',});// 新建一个类ES6export default class LifecycleComponent extends Component{constructor(props){super(props);console.log("------run------")this.state={count:0,}}componentWillMount(){console.log("------run componentWillMount------")}componentDidMount(){console.log("------run componentDidMount------")}componentWillReceiveProps(nextProps){console.log("------run componentWillReceiveProps------")}shouldComponentUpdate(nextProps,nextState){console.log("------run shouldComponentUpdate------")return true;}componentWillUpdate(nextProps,nextState){console.log("------run componentWillUpdate------")}componentDidUpdate(prevProps,prevState){console.log("------run componentDidUpdate------")}componentWillUnmount(){console.log("------run componentWillUnmoun------")}render(){console.log("run")return(<View><Text style={styles.text1}onPress={()=>{this.setState({count:this.state.count+1,})}}>  hello.LifecycleComponent holle多少次{this.state.count}</Text></View>);}}const styles = StyleSheet.create({text1:{fontSize:20,backgroundColor:'#f5f',}});


0 回复 有任何疑惑可以回复我~
#1

3DX退之

添代码某意思
2018-11-25 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
ReactNative入门与进阶
  • 参与学习       70536    人
  • 解答问题       166    个

React Native跨平台技术入门与进阶

进入课程

按老师的顺序及语法编写了js文件,运行结果如下!!

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信