Issue
I am new to reactJS and our current web application(Spring MVC) is HTTP based API. We are trying to convert JSPs to reactJS components. I observed that reactJS developer hard-coded base url(like http://DNSName:8080/AppContext) and using that making API call. But, this base url is different for each client like url contains different DNS Name and port number. Is there any other way to not hard-code base url and get it from environment?
Solution
You could use a relative url /AppContext, or if that's not what you're after, you could look into node environment variables and access it like process.env.my_url
Answered By - Ram