I am currently building an app using react native. And I have quite a few screens in it. As the app is still in development stage I still hit localhost now. I am wondering if there is a way to switch these url's programmatically while developing vs in production. Also considering that developing still continues even after the app is published and in the play store. How do anyone handle this scenario? Or am I thinking it in the wrong way?
答案 0 :(得分:0)
Try this code:
var url = '';
if (__DEV__) {
url = 'http://localhost';
} else {
url = 'http://exmple.com';
}