constaxiosAPI=axios.create({baseURL:"https://pokeapi.co/api/v2/"// it's not recommended to have this info here.});
Are you just suggesting we get the 'baseURL' constant from somewhere more global, or that there's a way to secure/hide that value? I was under the impression the front end can be seen by pretty much anyone...
You are correct about the fact that all front-end code is always visible to the end user.
I think the recommended method the author is referring to is a .env like file (npmjs.com/package/dotenv). Which does not hide the values but makes them more variable and easier to change without having to alter your code.
You might want your front-end connecting to different base URL's depending on what environment it is running (dev, staging, prod).
What did you mean by:
Are you just suggesting we get the 'baseURL' constant from somewhere more global, or that there's a way to secure/hide that value? I was under the impression the front end can be seen by pretty much anyone...
You are correct about the fact that all front-end code is always visible to the end user.
I think the recommended method the author is referring to is a .env like file (npmjs.com/package/dotenv). Which does not hide the values but makes them more variable and easier to change without having to alter your code.
You might want your front-end connecting to different base URL's depending on what environment it is running (dev, staging, prod).
Thanks for the response. Your points make sense.