I need to place my state inside a string, as I am rendering an image depending on which 'type' state is.
I have tried Template literals below:
constructor(props) {
super(props);
this.state = {
type: 'cafe'
}
And in my component:
<Image
source={require(
`../../../assets/icons/${this.state.type}.png`)}
/>
I would expect the outcome above to be:
<Image
source={require('../../../assets/icons/cafe.png')}
/>