我是 react.js 的新手我已经实现了一个组件,我在其中从服务器获取数据并使用它,
CallEnterprise:function(TenantId){
fetchData('http://xxx.xxx.xx.xx:8090/Enterprises?TenantId='+TenantId+' &format=json').then(function(enterprises)
{
EnterprisePerspectiveActions.getEnterprise(enterprises);
}).catch(function()
{
alert("There was some issue in API Call please contact Admin");
//ComponentAppDispatcher.handleViewAction({
// actionType: MetaItemConstants.RECEIVE_ERROR,
// error: 'There was a problem getting the enterprises'
//});
});
},
我想将 Url 存储在配置文件中,所以当我在测试服务器或生产上部署它时,我只需要更改配置文件中的 url,而不是在 js 文件中,但我不知道如何在 react.js 中使用配置文件
谁能指导我如何实现这一目标?