birkir / gatsby-plugin-prismic-preview

Preview plugin for gatsby-source-prismic
25 stars 3 forks source link

README does not match example #4

Open joseph-cloudthing opened 5 years ago

joseph-cloudthing commented 5 years ago

The README contains:

Usage

import { withPrismicPreview } from 'gatsby-plugin-prismic-preview';

const AboutPage = ({ data }) => (
  <h1>
    About
    {console.log('This will now include preview data:', data.prismicAboutPage.title)}
  </h1>
);

export default withPrismicPreview({ data })(AboutPage);

but the example folder contains no such usage:

joseph@DESKTOP:~/git/gatsby-plugin-prismic-preview$ grep -r withPrismicPreview example/
joseph@DESKTOP:~/git/gatsby-plugin-prismic-preview$

It would be nice if the two matched up.

birkir commented 5 years ago

It's not needed, page components are automatically wrapped by default. If you want customized control, you can use the HOC.

https://github.com/birkir/gatsby-plugin-prismic-preview/blob/master/src/gatsby-browser.tsx#L15-L20

But anyway the readme section is really lacking, and contributions are accepted. Thanks.

edit btw, this plugin is not in active development at the moment (accepting all PR's however), all my focus is on the gatsby-source-prismic-graphql plugin, which has much better docs, support and stability.