【发布时间】:2021-12-20 17:23:27
【问题描述】:
我尝试从 GET API 获取数据但我不想获取所有记录,仅记录与我以 json 格式发送的原始数据中的参数匹配 我该如何在本机反应中做到这一点请帮助
const GetData = () => {
axios({
method: 'get',
url: 'http://10.0.2.2:3000/DonarsRecod',
data: {
organ: "Lungs"
}
})
.then(function(response) {
console.log("response", JSON.stringify(response.data))
})
.catch(function(error) {
console.log("error", error)
})
}
【问题讨论】:
-
在 url 中将它们作为查询参数发送:10.0.2.2:3000/DonarsRecod?organ=Lungs 并在您的服务器端处理它以使用正确的数据进行回复
标签: node.js reactjs react-native