prismic-react provides compile-to-ReactElement methods for document & fragment types in the prismic.io JavaScript SDK.
npm install --save prismic-react
// just import prismic-react to add the .asReact methods everywhere there// are .asHtml methodsimport'prismic-react';myDocument.asReact();// it supports passing a link resolver just like .asHtmlmyDocument.asReact(linkResolver);// documents also support getting fragments as reactmyDocument.getReact('article.summary'/* , linkResolver */);// which is just shorthand for calling .asReact on the fragments themselvesmyDocument.getStructuredText('article.summary').asReact();That's literally all there is to it.
Apache 2.0