List of built-in hooks. (You can create your own.)

Basic

Advanced

Most users don't need to know about these hooks.

Upcoming

Potentially upcoming hooks:

Order

The order in which the hooks are called.

The following doesn't contain the hooks of the Vike extensions vike-react/vike-vue/vike-solid such as onAfterRenderHtml() or onAfterRenderClient().

Default

If you didn't change the environment of data() nor onBeforeRender():

First render

  1. server renderPage()
  2. server onBeforeRoute()
  3. server Routing

    The routing executes your Route Functions (of all your pages).

  4. server guard()
  5. server data()
  6. server onBeforeRender()
  7. server onRenderHtml()
  8. client onRenderClient()
  9. client onHydrationEnd()

Page navigation

  1. client onPageTransitionStart()
  2. client onBeforeRoute()
  3. client Routing
  4. server onBeforeRoute()
  5. server Routing

    The routing is executed twice: once for the client and once for the server.

  6. server guard()
  7. server data()
  8. server onBeforeRender()
  9. client onRenderClient()
  10. client onPageTransitionEnd()

Client-side only data()

If you configured data() and onBeforeRender() as well to run only on the client-side:

First render

  1. server renderPage()
  2. server onBeforeRoute()
  3. server Routing

    The routing executes your Route Functions (of all your pages).

  4. server onRenderHtml()
  5. client guard()
  6. client data()
  7. client onBeforeRender()
  8. client onRenderClient()
  9. client onHydrationEnd()

Page navigation

  1. client onPageTransitionStart()
  2. client onBeforeRoute()
  3. client Routing
  4. client guard()
  5. client data()
  6. client onBeforeRender()
  7. client onRenderClient()
  8. client onPageTransitionEnd()

See also