【发布时间】:2022-01-19 07:10:21
【问题描述】:
使用了map函数,但它在console.log上返回无限循环,我无法返回行,jsx也尝试了foreach,但没有帮助。无法在 jsx 中呈现数据。即使在循环内也可以控制台.log 数据。但不在渲染 jsx 上。
import React, { Component } from 'react';
import { TouchableOpacity,DrawerLayoutAndroid,Picker,ListView } from 'react-native';
import { Container, Header, Title, Content,List, ListItem, Text, Button, Icon,InputGroup, Input,View } from 'native-base';
import { Col, Row, Grid } from 'react-native-easy-grid';
import { Actions } from 'react-native-router-flux';
import axios from 'axios';
import styles from '../styles/homestyle';
export default class Home extends Component {
constructor(props) {
super(props);
this.state = {
user_namez : "",
user_pazz : "",
};
}
student_data(){
axios.get('http://192.168.0.108/easy_backend/app/app_db/stud_data')
.then((response) => {
let respdata = response.data ;
list.respdata(function(y){
return(<Text>{y.prnt_usernamez}</Text>);
});
});
}
render() {
return (
<View>
{this.student_data()}
</View>
)
}
}
【问题讨论】:
标签: reactjs react-native