【发布时间】:2020-02-10 07:17:33
【问题描述】:
我是 React Native 的新手。当我检查我的代码时,我正在从组件中学习但仍然得到错误的道具,即使在文档中使用道具组件反应本机,因为我正在使用但为什么仍然得到错误检查文档链接(https://facebook.github.io/react-native/docs/props)
import React, {Component} from 'react';
import { StyleSheet, Text, View } from 'react-native';
class UserInformation extends Component(){
render(){
return(
<View>
<Text>{this.props.Name}</Text>
<Text>{this.props.Status}</Text>
</View>
);
}
}
function App() {
return (
<View style={styles.container}>
<UserInformation Name='Hamza' Status='Single' />
<UserInformation Name='Shahwar' Status='Comitted' />
</View>
);
}
export default App;
错误:TypeError:无法设置未定义或空引用的属性“props”
【问题讨论】:
标签: javascript reactjs react-native