简体   繁体   中英

React.js attributes on tr gets discarded

I am building an app with react.js and bootstrap for react. I am trying to create a table row with class "success". However, passing attribute "class" to tr tag in react does not work, in the translated HTML there is no attribute whatsoever.

var Hello = React.createClass({
  render: function() {
    return <ReactBootstrap.Table bordered striped hover>
        <thead><tr><th>name</th></tr></thead>
        <tbody><tr class="success"><td>Jonas</td></tr></tbody>
    </ReactBootstrap.Table>
  }
});

Related JSFiddle - http://jsfiddle.net/7pqrwfch/

Use className instead:

<tr className="success">

(Read the note here: JSX in Depth )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM