小编San*_*ing的帖子

未处理的承诺拒绝:类型错误:网络请求在展会反应本机中失败

我正在使用 expo 创建 MERN React 本机移动应用程序,但我对如何使用 Express 连接 REST API 感到困惑。下面是代码。

应用程序.js

import React from "react";
import {
   StyleSheet,
   Text,
   View,
   TextInput,
   TouchableOpacity,
   SafeAreaView,
} from "react-native";

class Form extends React.Component {
   constructor() {
   super();
   this.State = {
      title: "",
      description: "",
   };
}

getInput(text, field) {
   if (field == "title") {
      this.setState({ title: text });
   } else if (field == "description") {
     this.setState({ description: text });
   }
   //console.warn(text)
 }
 submit() {
   let collection = {};
   (collection.title = this.state.title),
   (collection.description …
Run Code Online (Sandbox Code Playgroud)

rest express reactjs react-native expo

5
推荐指数
1
解决办法
7198
查看次数

标签 统计

expo ×1

express ×1

react-native ×1

reactjs ×1

rest ×1