...

/

Nuxt Component Options

Nuxt Component Options

Learn about Nuxt component options: asyncData, fetch, head, and layout.

Component options

In order to hook into the functionality that the framework offers, Nuxt allows us to add some specific properties and functions to our page components. Let’s take a look at them.

The asyncData component

Before a component is initialized, Nuxt will look to see if it has an asyncData() method. If it does, this method is called, giving us the opportunity to fetch any data we might need to render the component.

On the initial request, it will be run on the server, but once the app has loaded, subsequent calls will be run on the client as the user navigates around the running SPA.

The ...