
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeI can spot the issue! In @sanity/block-content-to-react, you're using the wrong serializer key. You're defining listItem when you should be using list instead.
The listItem serializer handles individual <li> elements, but the list serializer handles the wrapping <ul> and <ol> elements. Here's the corrected version:
list: props => {
switch (props.type) {
case "bullet": {
return <ul className="liststyle">{props.children}</ul>
}
case "number": {
return <ol>{props.children}</ol>
}
default: {
return <ul>{props.children}</ul>
}
}
},
listItem: props => <li>{props.children}</li>Notice two key changes:
listItem to list for the wrapper elementsprops.node.listItem to props.type - the list type is accessed via props.type, not props.node.listItemThe list serializer receives props.type which will be either "bullet" or "number", and props.children which contains all the rendered list items. The listItem serializer then handles how each individual <li> is rendered.
Side note: The @sanity/block-content-to-react package is deprecated. For new projects, you should use @portabletext/react instead, where the API is slightly different (uses components instead of serializers and value instead of node).
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