⚠️
The vite-plugin-ssr project has been renamed Vike.
  • If you are already using vite-plugin-ssr then migrate to Vike.
  • For new projects, don't use vite-plugin-ssr but use Vike instead.

usePageContext()

The usePageContext() UI component hook allows you to access pageContext from any UI component.

// AnyComponent.{jsx,vue}

import { usePageContext } from 'vike-react'
/* Or:
import { usePageContext } from 'vike-vue'
import { usePageContext } from 'vike-solid'
*/

// At any UI component:
const pageContext = usePageContext()

If you don't use vike-react/vike-vue/vike-solid, you can implement usePageContext() yourself as shown at Guides > Access pageContext anywhere.