PageViewer
The PageViewer component is used on your website’s public pages.
It is the component that renders a page on the front-end exactly as you can see it in the Admin Interface, but with React Bricks visual edit components (Text, RichText, Image, File, Repeater) in read-only mode.
Props
The PageViewer component has just one required prop: page
.
It is the page object you get from React Bricks APIs, using usePage
or fetchPage
.
Before passing the page object to PageViewer
, you need to parse it with the cleanPage
utility function, which checks incoming blocks from the DB against your bricks schema.
main
is true
by default. It enables the “click to edit” feature for this Page Viewer, regardless of the clickToEditSide
configuration. This is useful when you have multiple PageViewers on a page (for example for page content, header and footer) to choose which PageViewer is the “main” one that defines the slug to be edited with the icon. Previously this parameter was called showClickToEdit
.