
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@movement-react/prismic
Advanced tools
Prismic is a headless CMS system that allows you to easily create websites. React is one of the most popular JavaScript Frameworks. This library aims to help accelerate development with React and Prismic.
See the prismic docs for further details on their API's.
npm install @movement-react/prismic prismic-javascript
or
yarn add @movement-react/prismic prismic-javascript
optionally you can install prismic-reactjs
to render
their CMS components.
Below is a quick start to getting setup with the prismic react library.
Within your main component, import and wrap your jsx with the PrismicProvider
component.
import { PrismicProvider } from '@movement-react/prismic';
const App = () => {
const url = `https://${process.env.PRISMIC_DOMAIN}.prismic.io/api/v2`;
const accessToken = process.env.PRISMIC_ACCESS_TOKEN;
return (
<PrismicProvider url={url} accessToken={accessToken}>
<App />
</PrismicProvider>
);
}
From here you can use the React Hooks to query your prismic site.
A context provider for access the prismic client api. This allows you to query prismic from anywhere within your react application.
Name | DataType | Mandatory |
---|---|---|
url | string | * |
accessToken | string | * |
import { PrismicProvider } from '@movement-react/prismic';
const App = () => {
const url = `https://${process.env.PRISMIC_DOMAIN}.prismic.io/api/v2`;
const accessToken = process.env.PRISMIC_ACCESS_TOKEN;
return (
<PrismicProvider url={url} accessToken={accessToken}>
<App />
</PrismicProvider>
);
}
A react hook that fetches a prismic document by the type and UID or ID.
See the Prismic API for further details
Name | DataType | Mandatory |
---|---|---|
type | string | * |
id | string | * |
options | QueryOptions |
import { usePrismicFetchByID, PrismicProvider } from '@movement-react/prismic';
const Component = () => {
const { data, loading } = usePrismicFetchByID('page', 'my-page', { lang: 'en-us' });
console.log(data) // outputs document with uid 'my-page'
return (
<div>{data.id}</div>
);
}
const App = () => {
const url = `https://${process.env.PRISMIC_DOMAIN}.prismic.io/api/v2`;
const accessToken = process.env.PRISMIC_ACCESS_TOKEN;
return (
<PrismicProvider url={url} accessToken={accessToken}>
<Component />
</PrismicProvider>
);
}
A react hook that fetches documents from the prismic api using predicates.
See the Prismic Predicate API for further details on predicates
Name | DataType | Mandatory |
---|---|---|
predicates | string or string[] | * |
options | QueryOptions |
import { usePrismicQuery, PrismicProvider } from '@movement-react/prismic';
import Prismic from 'prismic-javascript';
const Component = () => {
const { data, loading } = usePrismicQuery([
Prismic.Predicate.at('document.type', 'page')
]);
console.log(data) // outputs an array of documents
return (
<div>{
data.map((result, i) => (
<div key={i}>{result.id}</di>
))}
</div>
);
}
const App = () => {
const url = `https://${process.env.PRISMIC_DOMAIN}.prismic.io/api/v2`;
const accessToken = process.env.PRISMIC_ACCESS_TOKEN;
return (
<PrismicProvider url={url} accessToken={accessToken}>
<Component />
</PrismicProvider>
);
}
FAQs
A react library for querying prismic.io's API
We found that @movement-react/prismic 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.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.