me-me
me-me

Reputation: 5819

Which to use for Prismic project, prismic-javascript, @prismicio/client, prismic-dom, prismic-reactjs

Cant find a distinctive difference on their docs so asking here.

prismic-javascript or @prismicio/client or prismic-reactjs or prismic-dom They all are npm packages. Can someone explain the 4 separate packages and when to use one over the other.

My assumptions.

Am I correct with the above assumptions ?

Upvotes: 1

Views: 339

Answers (1)

Alex Trost
Alex Trost

Reputation: 56

me, thanks for the question.

prismic-javascript is the old version, where @prismicio/client is version 4 of the library. I definitely see how that's confusing, I'm working on getting the references cleaned up so that's more straightforward.

prismic-dom contains helpers for things like rendering "Rich Text" fields to the DOM. They come from the API as JSON, so you need something like this to turn it into HTML.

prismic-reactjs is similar to prismic-dom, but turns Rich Text fields into JSX to work with React projects.

So if you're working on a vanilla JavaScript site, you'll use @prismicio/client + prismic-dom. If you're working on a React app, you'll use @prismicio/client + prismic-reactjs.

Upvotes: 1

Related Questions