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

218
Vistas
<svg> & <img> show different glyphs; <svg> has artifact

In React, I'm trying to display an SVG & be able to dynamically change it's color, but there is a weird "artifacting" going on when used as an component, even with the exact same code.

Left is <img src="checkmark.svg"/>, Right is as an <svg> React component

image

Code:

checkmark.svg

<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9 24L13.5 28.5L31 11" stroke="#626262" stroke-width="3" stroke-linecap="round"/>
</svg>

CheckmarkSVG.jsx

const StepCheckmarkSVG = () => {
    return (
        <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
        <path d="M9 24L13.5 28.5L31 11" stroke="#626262" stroke-width="3" stroke-linecap="round" />
        </svg>
    );
};

It's literally the same SVG code. Why are they displaying differently?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Looks good to me:

const element = 
  <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
    <path d="M9 24L13.5 28.5L31 11" stroke="#626262" stroke-width="3" stroke-linecap="round" />
  </svg>;

ReactDOM.render(element,document.getElementById('root'));
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>

<div id="root"></div>

enter image description here

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