I am making a seven day forecast react app. I have an images folder that has 28 icons for weather types split between day and night versions. Those images are imported like so into a component (for brevity I will only show 4 options):
import {
dayclear, daycloudy,
nightclear, nightcloudy
} from '../images'
Depending on the type of weather when this component is called, I'm trying to dynamically name an image source. Is there a way to concatenate a object name dynamically? Ex:
<img src={this.props.timeOfDay + this.props.weather} alt="Weather Image" />
I'm looking for that source to end up being the object name of the imported image.