如何在React Native中从Spring Boot中获取数据?

问题描述 投票:0回答:1

我有一个用react native expo创建的前端,后端是使用spring boot完成的,当我在本地运行spring boot并在浏览器中键入URL时,该模型位于google cloud中(不部署'localhost URL'),它显示浏览器上的数据。如何在不部署Google云的情况下将这些数据发送到我的本机应用程序。

spring-boot react-native fetch react-native-android expo
1个回答
0
投票
fetch('http://{your IP}:8081/') .then((response) => response.json()) .then((responseJson) => { this.setState({ message : responseJson.message.data }) }) .catch((error) => { console.error(error); });
现在我们有了

命令提示符,让您键入ipconfig,然后按Enter键并在IPv4地址下获取数字。此号码是您的本地IP。

© www.soinside.com 2019 - 2024. All rights reserved.