问题
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