⚠️
The vite-plugin-ssr project has been renamed Vike.
  • If you are using vite-plugin-ssr, migrate to Vike.
  • For new projects, use Vike instead of vite-plugin-ssr.
Vike itself (without extensions) is like vite-plugin-ssr: unopinionated and fully agnostic.

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.