
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeWelcome to the community! Happy to help you with your Portable Text issues.
The main thing to know is that Sanity has moved from the older @sanity/block-content-to-react package to the newer @portabletext/react library for rendering block content in React. If you're getting errors, this is often the first thing to check - make sure you're using the right package.
Here's the basic setup with @portabletext/react:
npm install @portabletext/reactThen in your React component:
import { PortableText } from '@portabletext/react'
function MyComponent({ content }) {
return <PortableText value={content} />
}Common issues and fixes:
@sanity/block-content-to-react, switch to @portabletext/reactcomponents propFor custom components, the pattern looks like:
<PortableText
value={content}
components={{
types: {
image: ({value}) => <img src={value.imageUrl} />
},
marks: {
link: ({children, value}) => <a href={value.href}>{children}</a>
}
}}
/>If you can share the specific error message you're seeing, that would help narrow down the issue! Common error messages include things like "Cannot read property 'map' of undefined" (usually a data fetching issue) or complaints about missing serializers (means you have custom content types that need components defined).
The Portable Text introduction guide and beginner's guide to Portable Text are great resources for understanding how it all works under the hood. Portable Text is Sanity's JSON-based rich text format that gives you platform-agnostic content you can render anywhere - once you get past the initial setup, it's really powerful for reusing content across different platforms!
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store