1
<img src="play.jpg" alt="play"></img>

Works perfectly in regular HTML but not in React. Is the only way to do it is add it as a background?

  • Are you getting any specific errors? If i had to guess i would say the relative path has changd but it's hard to tell from what you have provided.. – ajmajmajma Oct 02 '18 at 13:25
  • can we see more of your code? Where is the jpg being stored in relation to your component that is trying to display it? – markb Oct 02 '18 at 13:25
  • @Ado figured it out. React has to `require()` local images for some reason. –  Oct 02 '18 at 13:42

1 Answers1

4

Have you tried <img src={require('./play.jpg')} /> ? check out this question React won't load local images

Ado
  • 637
  • 1
  • 6
  • 17