
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
prismic-react-tools
Advanced tools
yarn add prismic-react-tools
Tools that you can use from this set:
Just pass your components and a serializer (optional) to the provider, then you may use the components refered above:
import React, { Component } from 'react'
import { PrismicReactToolsProvider } from 'prismic-react-tools'
// your components to be rendered as slices
import * as components from './components'
// your serializer for prismic data
import { serializer } from './lib'
class Layout extends Component {
render () {
return (
<PrismicReactToolsProvider
components={components}
serializer={serializer}
>
{/* ... */}
</PrismicReactToolsProvider>
)
}
}
PlainText//...
// use it with strings
<PlainText
content="Your name is {{ name }}, and you're {% adjective %}"
variables={{ adjective: 'cool', name: 'John Ganzas' }}
/>
// use it with single rich text from prismic (asText)
// be aware that you can pass variables here too
<PlainText content={content} />
//...
RichText//...
// use it with strings
<RichText
content={content}
variables={{ myVar: 'Some variable' }}
/>
//...
Slice//...
// just create your slice in prismic with the
// match name of you component
// example: in Prismic, call your slice `Item List` (Prismic will turn in `item_list`)
// and you just need to be sure you have the component `ItemList`
<Slice {...sliceObjectFromPrismic} />
// then in your component just access to all the data in the props ;)
//...
Slices//...
// just pass the array with slices and
// this will just map that array and render
// slice by slice
<Slices slices={slicesFromPrismic} />
//...
withPrismicPreviewSimple simple, this will just create a preview page for you with the same strategy that is used in gatsby-source-prismic-with-magic
import * as pageComponents from '../layouts';
import { withPrismicPreview } from 'prismic-react-tools';
import prismicOptions from '../../prismic-config';
export default withPrismicPreview({ pageComponents, ...prismicOptions });
important note here is to setup the options exactly as in gatsby-source-prismic-with-magic, that way, will be ensuring the preview will be fed by the same data as the static pages
options:
module.exports = {
accessToken, // Prismic access token
langs, // language object ex: { 'en-us': { default: true, path: 'en }, 'pt-pt': { path: 'pt' } }
layoutsKey = 'page_-_', // layouts key that match your pages in Prismic
layoutNameExceptions = {}, // exceptions (view more about this in `gatsby-source-prismic-with-magic`)
layoutsPath = 'src/layouts', // layouts path for your page components (used by `gatsby-source-prismic-with-magic`)
onCreatePage, // function that runs on create each page (view `gatsby-source-prismic-with-magic` docs)
onCreatePages, // function that runs on create all pages (view `gatsby-source-prismic-with-magic` docs)
repositoryName // Prismic repository name
}
This set of tools can be really usefull with my Gatsby Prismic fetch plugin
MIT © psoaresbj
FAQs
>
We found that prismic-react-tools demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.