From c2ffc076c9d520db766d82bbc25f5b3d7b195a80 Mon Sep 17 00:00:00 2001 From: Guayo Mena Date: Tue, 5 Feb 2019 17:04:51 -0600 Subject: [PATCH] fix(docs): add example for pageContext usage within a page (#11580) ## Description This page explains very well that you can pass `context` to a page automatically created, but it's missing an example of how to use it in a page via `pageContext`. I think it is important to explicitly explain it because the name of the variable is different to the prop name. I added an example. ## Related Issues I didn't find any related issues. --- docs/docs/creating-and-modifying-pages.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/docs/creating-and-modifying-pages.md b/docs/docs/creating-and-modifying-pages.md index 166379d0ddf85..9e1b3aa6a2b79 100644 --- a/docs/docs/creating-and-modifying-pages.md +++ b/docs/docs/creating-and-modifying-pages.md @@ -152,3 +152,15 @@ exports.onCreatePage = ({ page, actions }) => { }) } ``` + +On your pages and templates, you can access your context via the prop `pageContext` like this: + +```jsx +import React from "react" + +const Page = ({ pageContext }) => { + return
{pageContext.house}
+} + +export default Page +```