In my react native app I am trying to perform a fetch to my local backend server. In my package.json I have put "proxy": "http://localhost:3000" .
My fetch looks like
fetch('/')
.then(response => response.json())
.then(json => console.log(json))
.catch(err => console.log)
Run Code Online (Sandbox Code Playgroud)
It catches an error
[TypeError: Network request failed]
Run Code Online (Sandbox Code Playgroud)
When I remove the proxy and manually enter the address in the fetch it works and my server receives a GET request.
fetch('http://localhost:3000')
.then(response => response.json())
.then(json => console.log(json))
.catch(err => console.log)
Run Code Online (Sandbox Code Playgroud)