score:0

Accepted answer

i don't think you are experiencing problems because of the way you are loading your image (i tried @michael's answer and it did not load the images for me, while your code worked.)

here is the minimal code i wrote to check your solution and it works perfectly on my end. maybe try editing your post to add a bit more context to your question.

score:0

you should import images in the parent component and then pass them to child components like a component.

try this:

import a1old from '../img/a1-old.png'
import a2old from '../img/a2-old.png'

class board extends react.component {
  constructor(props) {
    super(props);
    this.state = {
      squares: [
        { title: "a1", image: <a1old /> },
        { title: "a2", image: <a2old /> },
      ]
    };
  }
  ...


Related Query

More Query from same tag