我有一个这样的父组件
export default class Parent extends Component{
.....
render() {
let props = {
lat: this.state.lat,
long: this.state.long
}
return(
<View style={{flex: 1}}>
<Child props = {this.props}/>
</View>
)
}
}
当我尝试将2个经纬度值传递给这样的组件时:
export default class Child extends Component{
constructor(props) {
super(props)
}
render(){
return (
<View>
<Text>{"Longitude: " + this.props.long}</Text>
<Text>{"Latitude: " + this.props.lat}</Text>
</View>
);
}
}
我的屏幕如下:
Longitude: undefined
Latitude: undefined
那么在这种情况下我犯了哪些错误?