'Using RichText in a map in React

Thank you so, so much for your time looking at this

I'm using React and Prismic I'm trying to apply RichText (https://prismic.io/docs/technologies/rendering-the-rich-text-and-title-field-reactjs) to render the text but do not work on map.

My guess is that I'm loosing some logic here but I can't understand what is This show the content without rendering:

{prismicDoc?.data?.contenido?.map(x => x?.text || null)}

This show me an error:

{RichText.render(prismicDoc?.data?.contenido?.map(x => x?.text || null))}

The error is TypeError: Cannot read properties of undefined (reading 'map')

Could you please let me know what I'm doing wrong?

Thanks Laura



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source