Next.js Discord

Discord Forum

Appending to Head using a component?

Answered
Atlantic salmon posted this in #help-forum
Open in Discord
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 <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 })
View full answer

3 Replies