1

I am creating react native app for (Web, IOS,Android). I have svg image that i want to render in web and android. This is my code :

import React from "react";
import { SvgXml } from "react-native-svg";  
const  SvgComponent = () => { 
  const svgMarkup = `MY SVG FILE CODE`;
  const SvgImage = () => <SvgXml xml={svgMarkup} width="301px" />;  

  return <SvgImage />;
 
}

export default SvgComponent ;

&
import SvgComponent  from 'filelocatio';
<SvgComponent  />

But when I am import it in file and using it as component, I am getting this error : react-dom.development.js:28389 Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Any idea what i am doing wrong here.?

spjgoku
  • 71
  • 1
  • 6

0 Answers0