I have an issue with displaying of random image with webpack. I have a directory, with several images, like
1.jpg, 1-cropped.jpg
2.jpg, 2-cropped.jpg
import 1 from '../1.jpg'
It's easy. You can use require
inside the render
. Like the example below:
render() {
const {
someProp,
} = this.props
const graphImage = require('./graph-' + anyVariable + '.png')
const tableImage = require('./table-' + anyVariable2 + '.png')
return ()
}