how can i fix this with Axios, Are there any parameters ?
axios.get('/slug', { params })
Preconnect to required origins Consider adding
preconnect
ordns-prefetch
resource hints to establish early connections to important third-party origins. Learn more.
why chrome audit declares this opportunity when this url does not exist in the source code
All resource hints can be used only as attributes on a <link>
element. You can read about what they do and how for example here
So there is nothing you can do directly in JavaScript (except of course adding the attribute to existing link dynamically based on user action)
If your are requesting something using Axios from domain https://api.my-app.com
, just including <link rel="preconnect" href="https://api.my-app.com" />
into your page should be enough...