Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH 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
The npm package @movement-react/prismic receives a total of 2 weekly downloads. As such, @movement-react/prismic popularity was classified as not popular.
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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.