Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Do React Native proxys work differently to vanila react proxys?

$
0
0

I'm trying to fetch data from a API running locally on port 5000 my device. From working on React web apps I'm used to setting the proxy in package.json like this:

"proxy": "https://localhost:5000"

Now I try to fetch something from the API like this:

fetch("/colours", {            method: "GET",            headers: {"Content-Type": "application/json;charset=utf-8",            }        })...

Sadly if I now run my application on my browser it still says that it sends the request to http://localhost:19006/colours. The responds contains HTML for a reload button.

I also checked on my APIs console, no request ever arrives there. I have tried the usual tricks of deleting package-lock.json and node_modules and installing again.

Is my approach to API requests fundamentally wrong for React Native?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>