Iterating over JSON in React

前端 未结 4 964
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-14 21:22

I have following code:

export class Highlights extends React.Component {
    render() {
        return (
            
{JSON.string
4条回答
  •  无人及你
    2020-12-14 22:26

    var Highlight = React.createClass({
      render: function() {
        const {value, label} = this.props;
        return 
    {label}: {value}
    ; } }); var Highlights = React.createClass({ render: function() { const {active, automatic, waiting, manual} = this.props.highlights_data.data; return (
    ); } }); const data = {data:{"active":{"label":"Active","value":"12"},"automatic":{"label":"Automatic","value":"8"},"waiting":{"label":"Waiting","value":"1"},"manual":{"label":"Manual","value":"3"}}}; ReactDOM.render( , document.getElementById('container') );

提交回复
热议问题