[英]Unexpected error in react native
I am new in react-native, creating a demo for learning. 我是本机新手,创建了一个学习演示。 I am getting error in line no.
我在行号中遇到错误。 11 of my DataDetail file DataDetail.js Unexpected token (11:2) .
我的DataDetail文件中的11个DataDetail.js意外令牌(11:2) 。 Below is the code for my DataDetail file.
以下是我的DataDetail文件的代码。
1. //DataDetail.js
2.
3. import React from 'react';
4. import {Text,View} from 'react-native';
5.
6. const DataDetail = (props) => {
7. return (
8. <View>
9. <Text>{props.objData.title}</Text>
10. </View>>
11. );
12. };
13.
14. export default DataDetail;
I am calling this from my Component: 我从我的组件调用此:
import DataDetail from './DataDetail';
import React, {Component} from 'react';
import {Text,View} from 'react-native';
import axios from 'axios';
export default class Home extends Component<Props> {
state = {arrData:[]};
componentWillMount(){
axios.get('https://reduxblog.herokuapp.com/api/posts')
.then(response => this.setState({arrData:response.data}));
}
renderList(){
return this.state.arrData.map(data => <DataDetail key={data.id} objData={data} />);
}
render() {
return (
<View>
{this.renderList()}
</View>
);
}
}
Can anyone help me here to understand, what I am doing wrong here. 有人可以在这里帮助我了解我在做什么错。
Thanks 谢谢
You had 2 >
when closing the View
tag. 关闭
View
标签时,您有2 >
。
6. const DataDetail = (props) => {
7. return (
8. <View>
9. <Text>{props.objData.title}</Text>
10. </View>
11. );
12. };
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.