Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

245
Vistas
Parse html tags from a JSON file in ReactJs

In a ReactJs application, fetching data from a Json file which contains some HTML tags, which is displayed as string without interpreting it as HTML.

I considered to use dangerouslySetInnterHTML. However, according to React's official documentation, setting HTML from code seems to be risky.

Any other best practice to achieve the same.

Sample Json:

{
  "FAQ" : {
             "contents": "Lorem ipsum dolor sit amet. <a href=\"www.test.com\">www.test.com</a>",
          }
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

To parse html tags in a Json content in a React application there is a npm package available name 'html-to-react'

Usage:

import React from 'react';
import convertHtmlToReact from '@hedgedoc/html-to-react';

class HtmlComponent extends React.Component {
  render() {
    const html = '<div>Example HTML string</div>';
    return <div>{ convertHtmlToReact (html, true) }</div>;
  }
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda