const usePageValues = (): [
(pageData: types.PartialPage) => void

Hook with no arguments that returns a [pageValues, setPageValues] array.

  • pageValues is an object with the values you see below
  • setPageValues is a function to set the values (which will merge the object one level deep).

On the frontend Viewer the setPage function performs no acton. In that case you should take just the first element with the pageValues.


The values you can access are:

id: string
type: string
name: string
slug: string
meta: {
title?: string
description?: string
language?: string
featuredImage?: string
readingTime?: number
authorId?: string
author: Author
invalidBlocksTypes?: string[]
status: PageStatus
isLocked: boolean
tags: string[]
createdAt: string
publishedAt?: string

The readingTime is expressed in minutes and calculated based on the length of the plain text content of the page.

See the Page type and IMeta interface

Example usage

const [page, setPage] = usePageValues()
// Set meta title equal to the "title" props anytime it changes
useEffect(() => {
meta: {,
title: typeof title === 'string' ? title : Plain.serialize(title),
}, [title])
return (
Created at {moment(page.createdAt).format('MM/DD/YYYY')}.
{page.readingTime && <span>{page.readingTime} minutes read.</span>}