按老師的順序及語法編寫了js文件,運行結果如下??!
按老師的順序及語法編寫了js文件,運行結果如下??!
按老師的順序及語法編寫了js文件,運行結果如下??!
2018-07-16
/***?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',}});
舉報
2018-11-25
現在已經是異常渲染了