首页 > 解决方案 > 在邮递员中获取 api 工作,但在本机反应中不工作

问题描述

我想在 react native 中获取我的 api,但 react 不显示我的结果,此 api 显示在邮递员中但不显示在 react native 中,在我更改我的 api 后这对我有用但不显示此 api。我的代码是:

fetch('http://roomarket.ir/LlIi1/CT.php')
  .then((response13) => response13.json())
    .then((response3) => {
      this.setState({Alert.alert(response3.ENtime)})

我如何在本机反应中获取它请帮助我

标签: apireact-nativefetch

解决方案


尝试这个。

fetch('http://roomarket.ir/LlIi1/CT.php')
  .then((response) => response.json())
    .then((responseData) => {
      this.setState({response:responseData. ENtime},() => Alert.alert(this.state.response))

推荐阅读