Network request failed in react native expo

瘦欲@ 提交于 2021-01-28 09:49:42

问题


im using expo in react native.i have a problem when post data to api laravel.its say"Network Request Failed".heres my code:

i hope you can help me guys thankyou.enter image description here


回答1:


I see that your fetch URL is served using an HTTP endpoint. You can only make requests to HTTPS endpoints from react-native projects.

A possible workaround is to use ngrok. Just download it and run:

./ngrok http 8000

Since your port number is 8000. It will expose an HTTPS endpoint and replace your fetch URL with that link and try fetching the data again



来源:https://stackoverflow.com/questions/62076086/network-request-failed-in-react-native-expo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!