I'm using the create-react-app template.
In one of my components, I am importing the path to several images like so.
import iconAvatar from '../img/icon-avatar.png';
import iconHome from '../img/icon-home.png';
import iconVendor from '../img/icon-vendor.png';
Now let's say I have a variable like this, which determines what image to use.
let imageType = "avatar"; // or "home", or "vendor", etc.
I want to dynamically render out the proper image based on the value of imageType (without having to use a convoluted if-else structure)
Something like the following (except that it won't work)
<img src={"icon"}{imageType}/>
How do I do this?