2

I have an image in my react class and want to achieve this:

<img src="images/status{this.props.status}.jpg"/>

How to do that?

Kokesh
  • 3,165
  • 7
  • 29
  • 46

1 Answers1

4

Found the solution:

<img src={'images/status' + this.props.state + '.jpg'}/>

That was hell of a noob question :)

Kokesh
  • 3,165
  • 7
  • 29
  • 46
  • You could also make a variable before the rendering, like this: ```var img = 'images/status' + this.props.state + '.jpg';``` Then incject the var img into the src – magnudae Dec 05 '14 at 10:33