-1

Below is the part of code of my React App:

<span 
  value={this.props.range}
  style={{width:"{this.props.range}px"}}
  className="range"
></span>

I want to use the value from the props and want to set into style. But I am not getting how to set it.

Emile Bergeron
  • 17,074
  • 5
  • 83
  • 129
Rachit Gupta
  • 89
  • 1
  • 2
  • 8

1 Answers1

0

Try template strings like this:

<span 
  value={this.props.range}
  style={{width:`${this.props.range}px`}}
  className="range"
></span>
aldenn
  • 2,060
  • 2
  • 11
  • 30