首页 > 解决方案 > 我无法访问 reactjs 中的类属性

问题描述

Implementation:
  <tr>
        <td class = 'show_hours'>{Number(this.props.showHours).toLocaleString()}</td>
       <td class = 'waiting_hours'>{Number(this.props.waiting).toLocaleString()}</td>
   </tr>



/*Testcase:


describe('RenderJobsRow',() => {
    it('Commas separated with Numbers.',() => {
        const wrapper = shallow(<RenderJobsRow
            showHours={23567}
            waiting  ={3214524}
        />)
        expect(wrapper.find('.show_hours').text()).toEqual('23,567')
        expect(wrapper.find('.waiting_hours').text()).toEqual('3,214,524')
    })
})

* /*当前错误信息:

/*方法“文本”仅用于在单个节点上运行。找到了 0 个

*

标签: reactjs

解决方案


<tr>
   <td className = 'show_hours'>{Number(this.props.showHours).toLocaleString()}</td>
   <td className = 'waiting_hours'>{Number(this.props.waiting).toLocaleString()}</td>
</tr>

推荐阅读