How to change ReactJS styles dynamically?

前端 未结 1 328
星月不相逢
星月不相逢 2020-12-14 13:52

I was trying to run ReactJS inside my twitter bootstrap web app. I have some issues using styles.

Having this div:

   ...
   
相关标签:
1条回答
  • 2020-12-14 14:34

    Ok, finally found the solution.

    Probably due to lack of experience with ReactJS and web development...

        var Task = React.createClass({
        render: function() {
          var percentage = this.props.children + '%';
          ....
            <div className="ui-progressbar-value ui-widget-header ui-corner-left" style={{width : percentage}}/>
          ...
    

    I created the percentage variable outside in the render function.

    0 讨论(0)
提交回复
热议问题