I have been trying add an image using the tag on CodeSandbox.io. However, every time I try to add it, it doesn't show and just defaults to the alt tag (Displays logo).
import React from "react";
import logo from "./logo.svg";
import "./App.css";
function App() {
return (
<div className="App">
<header className="App-header">
<img src={require("./logo.svg")} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
export default App;
You can checkout my code and a live demo at this codesandbox link
Codesandbox doesn't support directly importing images. Instead, you can either add them as static uploads and reference their uploaded URL or import them as React components: