how to use svg in react code example

Example 1: importing svg into react

import React from 'react';
import { ReactComponent as BrandIcon } from "./assets/brand-icon.svg";

export default function(){
  return( 
      <div>
          <BrandIcon />
      </div>
   );
}

Example 2: import svg react

import React from 'react';
import LogoName from '../assets/logo.svg'

const Header = () => {
    return ( 
        <div>
           	<img src={LogoName} alt="logo"/>
        </div>
     );
}

Example 3: react-native-svg

yarn add react-native-svg

Example 4: how to get svg from pucblic folder in react

import { ReactComponent as Avatar1 } from './assets/avatar_1.svg';

use it as <Avatar1 />