Appending to Head using a component?
Answered
Atlantic salmon posted this in #help-forum
Atlantic salmonOP
Hi there 👋 ,
For a project I have created a custom Image component, which I want to preload the data through the head when a certain prop is set. In the pages-implementation of Next I could use
How would I go about this, if at all?
For a project I have created a custom Image component, which I want to preload the data through the head when a certain prop is set. In the pages-implementation of Next I could use
<Head> to set this link in the head of the document through the component - however, I don't see a way to do this using the app directory - since <Head> is not supported there. How would I go about this, if at all?
Answered by Ray
you need to do this
ReactDOM.preload(href: string, options: { as: string })3 Replies
you need to do this
ReactDOM.preload(href: string, options: { as: string })Answer
Atlantic salmonOP
Thanks, that's the solution I was looking for!