In my react project how can I use all the images from a folder?
I tried this :
importAll(r) {
return r.keys().map(r);
}
userPath="../css/pics/"+this.props.user+"/";
images = this.importAll(require.context("../css/pics/"+this.props.user, false, /\.(png|jpe?g|svg)$/));
But this is giving TypeError: __webpack_require__(...).context is not a function
.
I know this question is already asked here : How to import all images from a folder in ReactJS? But it didn't helped me.
Now how can I solve this?