Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add support / demo of SSR Preview content #21

Open
jasikpark opened this issue Feb 20, 2023 · 0 comments
Open

Feature Request: Add support / demo of SSR Preview content #21

jasikpark opened this issue Feb 20, 2023 · 0 comments

Comments

@jasikpark
Copy link

jasikpark commented Feb 20, 2023

It would be great to demo how to render preview Sanity content in a live demo environment, maybe by serving https://github.com/portabletext/react-portabletext w/ client:load when in preview mode, to get live rendering of the content?

ex,

---
import {PortableText} from '@portabletext/react'
import { IS_PREVIEW } from '~/env';
---

{IS_PREVIEW ? 
  <PortableText
  client:load
  value={[/* array of portable text blocks */]}
  components={/* optional object of custom components to use */}
/> :
  <PortableText
  value={[/* array of portable text blocks */]}
  components={/* optional object of custom components to use */}
/>}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant