React Bricks

usePage


The usePage hook lets you easily retrieve the content of a page from React Bricks' APIs.

The only argument of this hook function is the slug string.

Usage example

...
  const { data } = usePage('home')

  const { pageTypeSchema, blockTypeSchema } = useContext(ReactBricksContext)
  const page = cleanPage(data, pageTypeSchema, blockTypeSchema)

  return <PageViewer page={page} />
...