Rendering Portable Text in Sanity CMS

Hi is there any simple way to render portable text, I am trying to avoid writing custom component for it? I am using sanity as my CMS and I am using block content as my body, so I need to convert the portable text html to able to show it

Hi, yes, you can create a react component that calls a portable text library to render as html

It does require a custom react component, but once you have this, you can use it repeatedly

Yeah I agree, I was just surprised because it is a very useful component and is very simple

import * as React from 'react';
import { PortableText } from '@portabletext/react'
import type { PortableTextBlock } from '@portabletext/types'

const RichText = ({ values, className }: { values: PortableTextBlock[], className?: string }) => {
  return (
    <div className={className ? className : ''}>

export default RichText

Here is what I did

:100: Nice!