import React from 'react';
import { ReactComponent as BrandIcon } from "./assets/brand-icon.svg";
export default function(){
return(
<div>
<BrandIcon />
</div>
);
}
import React from 'react';
import LogoName from '../assets/logo.svg'
const Header = () => {
return (
<div>
<img src={LogoName} alt="logo"/>
</div>
);
}
//customIcon.js
import React from "react";
import {ReactComponent as ImportedSVG} from "path/to/myIcon.svg";
import { SvgIcon } from '@material-ui/core';
function CustomIcon() {
return(
<SvgIcon component={ImportedSVG} viewBox="0 0 384 512"/>
)
}
export default CustomIcon;
import React from 'react';
import { ReactComponent as YourSvg } from './YourSvg.svg';
const MyComponent = () => {
return(
<YourSvg/>
);
}
export default MyComponent ;
import React from 'react';
import {ReactComponent as ReactLogo} from './logo.svg';
const App = () => {
return (
<div className="App">
<ReactLogo />
</div>
);
}
export default App;
import YourSvg from "/path/to/image.svg";
const App = () => {
return (
<div className="App">
<img src={YourSvg} alt="Your SVG" />
</div>
);
};
export default App;
<span>
<object style={{ float: 'left', height: '15px', position: 'relative', top: '4px' }} data={`${ROOT_URL}/assets/images/svg-icons/history-icon.svg`} type='image/svg+xml'></object>
</span>
//Use this WEB APP to convert any svg to a valide reactJs or React native Component
Playground - SVGR
https://react-svgr.com/playground/