我正在使用ionic 3 whatsapp clone github
项目,但是当我运行ionic serve命令时,当我尝试安装appscripts
错误时出现此错误npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
I'm new to react native, I'm bit confused about components.
As I created first react native app I saw App.js
the components in App.js created as per following code:
export default function App() {
...
}
Run Code Online (Sandbox Code Playgroud)
and as I saw tutorials many people almost all people making components as per following code:
const FirstComponents = () => {
...
}
Run Code Online (Sandbox Code Playgroud)
I'm also confuse about function components and class based components which created as per following code:
export default class FirstComponents …
Run Code Online (Sandbox Code Playgroud) 我在练习时收到错误状态未定义,因为我检查文档,他们使用相同的格式来创建状态
function App() {
// build state
state = {
Name:'Hamza',
Status: 'Comitted'
};
// function
ChangeProfile=()=>{
this.setState({
Name: 'Shahwar'
});
this.setState({
Status: 'Divorced'
});
console.log('updated',this.state);
}
return (
<View style={styles.container}>
<Text>{this.state.Name}</Text>
<Text>{this.state.Status}</Text>
<Button title="Click Me!" onPress={this.ChangeProfile} />
</View>
);
}
export default App;
Run Code Online (Sandbox Code Playgroud)