How to access a DOM element in React? What is the equilvalent of document.getElementById() in React

前端 未结 4 1788
面向向阳花
面向向阳花 2020-11-22 05:34

How do I select certain bars in react.js?

This is my code:

var Progressbar = React.createClass({
    getInitialState: function () {
        return {          


        
4条回答
  •  一向
    一向 (楼主)
    2020-11-22 06:16

    You can replace

    document.getElementById(this.state.baction).addPrecent(10);
    

    with

    this.refs[this.state.baction].addPrecent(10);
    
    
      
    

提交回复
热议问题