importing svg into react
import React from 'react';
import { ReactComponent as BrandIcon } from "./assets/brand-icon.svg";
export default function(){
return(
<div>
<BrandIcon />
</div>
);
}
importing svg into react
import React from 'react';
import { ReactComponent as BrandIcon } from "./assets/brand-icon.svg";
export default function(){
return(
<div>
<BrandIcon />
</div>
);
}
import svg react
import React from 'react';
import LogoName from '../assets/logo.svg'
const Header = () => {
return (
<div>
<img src={LogoName} alt="logo"/>
</div>
);
}
how to import svg in react
//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;
convert svg to react component
//Use this WEB APP to convert any svg to a valide reactJs or React native Component
Playground - SVGR
https://react-svgr.com/playground/
Svg as a component react
import React from 'react';
import {ReactComponent as ReactLogo} from './logo.svg';
const App = () => {
return (
<div className="App">
<ReactLogo />
</div>
);
}
export default App;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us