Correct path for img on React.js
In create-react-app
relative paths for images don't seem to work. Instead, you can import an image:
import logo from './logo.png' // relative path to image
class Nav extends Component {
render() {
return (
<img src={logo} alt={"logo"}/>
)
}
}
If you used create-react-app to create your project then your public folder is accessible. So you need to add your image
folder inside the public folder.
public/images/
<img src="/images/logo.png" />