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

423
Vistas
when using svg in react its gives me error everytime

I created an SVG using adobe illustrator But when trying to add to the project it just gives an error and the same goes with SVG I created with SVGator in short every single SVG gives me an error but using in bare HTML project its runs perfectly.

can anyone guide me on how to use SVG to react

errors I got

  1. SVG with Adobe

    <style>.cls-1{fill:url(#a);}</style>
    

after adding {} as it suggested gives me this

Private names are only allowed in property accesses (`obj.#a`) or in `in` expressions 
 <style>.cls-1{{fill:url(#a)}}</style>
  1. Error when SVG is downloaded from the website

    Compiled with problems:

     ERROR
    
     [eslint]
     src\components\common\RegisterSvg.js
       Line 8:32256:  Parsing error: Unexpected token (8:32256)
    
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

For those who might get this error with their SVG try importing SVG and use it as an image if SVG is static

import FormSvg from "./svg/newtest.svg
<img src={FormSvg} alt="svg"/>

if SVG has animation attached to it then add the SVG JavaScript in the useEffect and then use it as a normal SVG

useEffect(() => {
  // ... javascript goes here 
  // !function ... long code (<script>code from script</script>)
  }, []);
  return (
      // SVG part goes here
      <Svg/>
  )
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