我想通过 fetch API 将一些数据发送到服务器,以便它可以基于此查询数据库。与 Ajax 不同,我找不到任何合适的方法来做到这一点。这是我的 fetch 电话:
{fetch("http://192.168.90.53:4000/game/?email=adicool2294@gmail.com", {method: "GET"} )
.then((response) => response.json())
.then((responseData) => {
id= responseData.id;
name= responseData.name;
console.log(responseData);
})
.catch((error) => {
console.warn(error);
});
}
}
Run Code Online (Sandbox Code Playgroud)
我想发送一个参数,例如电子邮件,以便服务器可以使用它查询数据库。我正在使用 react-native android 因此不能使用 Ajax 请求。我只想使用 GET 方法。目前,服务器未在 req.query 中显示我在 URL 中传递的查询参数
使用此组件时收到警告。尝试将此组件用作按钮。我尝试了require('TouchableNativeFeedback'),但没有用。我也尝试npm安装TouchableNativeFeedback,但是失败了。应该如何将其合并到我的本机android代码中?
{
var TouchableNativeFeedback= require('TouchableNativeFeedback');
var Button= require('react-native-button');
var {
AppRegistry,
StyleSheet,
Text,
View,
Image,
TouchableNativeFeedback,
} = React;
var AwesomeProject = React.createClass({
render: function() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
My first App
</Text>
<Text style={styles.instructions}>
we should get started
</Text>
<Text style={styles.instructions}>
Nice!!
</Text>
<Image source={require('./abc.png')} style={styles.img} >
<Text style={styles.welcome}> Inside an image! </Text>
</Image>
<TouchableNativeFeedback
style={styles.img} >
<View>
<Text style= {styles.instructions}>
Button!
</Text>
</View>
</ TouchableNativeFeedback>
<Button style={styles.img} onClick="this.butclick">
<View>
<Text style={styles.instructions}>
This is a Button …Run Code Online (Sandbox Code Playgroud)