Typos
Removehtml

Remove HTML Tags

This Remove HTML Function is used for removing HTMLTags from the Rich Texts.

Remove HTML

removeHTML.tsx
export function removeHTMLTags(str: string) {
  const regex = /(<([^>]+)>)/gi
  return str.replace(regex, '').replace(/&nbsp;/g, ' ')
}

Usage

blogCard.tsx
<HTML
  dangerouslySetInnerHTML={{
    _html: removeHTMLTags(blog?.content),
  }}
/>