Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function importAll(r) {
- let images = {};
- r.keys().map((item, index) => { images[item.replace('./', '')] = r(item); });
- return images;
- }
- const images = importAll(require.context('./images', false, /\.(png|jpe?g|svg)$/));
- <img src={images['image_name.png']} />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement