【发布时间】:2020-04-29 06:31:18
【问题描述】:
我有一个使用 react native expo 创建的前端,我的后端是使用 spring boot 完成的,当我在本地运行 spring boot 并在浏览器中键入 URL 时,模型位于谷歌云中(不部署“localhost URL”)它在浏览器上显示数据。如何在不部署谷歌云的情况下将这些数据获取到我的 react 本机应用程序。
componentDidMount() {
fetch('http://192.168.56.1:8080/users/toFrontend?email=meNewTwo@gmail.com')
.then((response) => response.json())
.then((json) => {
this.setState({ data: json});
})
.catch((error) => console.error(error))
.finally(() => {
this.setState({ isLoading: false });
});
这是我使用的代码
【问题讨论】:
标签: spring-boot react-native fetch react-native-android expo