[英]React Native render function gives an error : Unexpected token
I am trying out a basic example to work on AsyncStorage on react native. 我正在尝试一个基本示例在React Native上使用AsyncStorage。 When I try to run the application, it throws an error at the render function.
当我尝试运行该应用程序时,它将在render函数上引发错误。
Here is my code- 这是我的代码-
var AsyncStorageExample = React.createClass({
getInitialState: function () {
return {
arr : [],
}
},
stateSetting: function(arrval) {
this.setState({
arr : arrval,
},
render : function() {
return (
<View>
{this.state.arr.map(arr =>
<Text key={arr.name}>
• {arr.name}
</Text>
)};
</View>
);
},
});
Error is thrown at the : of render function render : function(){
Unexpected token is what I get on the red screen. 在渲染功能的
render : function(){
处抛出错误: render : function(){
意外的标记是我在红屏上看到的。
What am I doing wrong here? 我在这里做错了什么?
this 这个
this.setState({
arr : arrval,
should be 应该
this.setState({
arr : arrval,
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.