Can just import a image and then the result will the final url after web pack
import React from'react';import logo from'./logo.png'; // Tell Webpack this JS file uses this imageconsole.log(logo); // /logo.84287d09.pngfunctionHeader() {// Import result is the URL of your imagereturn <imgsrc={logo} alt="Logo" />;}exportdefault Header;
Or css
.Logo {background-image:url(./logo.png);}
Can import SVG as component
All props are just dumped into the svg outer tag
import { ReactComponent as Logo } from'./logo.svg';constApp= () => ( <div> {/* Logo is an actual React component */} <Logowidth="40px"height="40px"className="checksvg" /> </div>);
Included in create-react-app, but under the hood is svgr