React equivalent for ng-repeat

后端 未结 5 1133
梦谈多话
梦谈多话 2021-02-06 21:43

I am new to React.js. I am trying to bind data arrays. I am looking for the equivalent of ng-repeat, but i can\'t find it inside documentation.

e.g:

var         


        
5条回答
  •  野的像风
    2021-02-06 22:14

    In your render function inside a react component you can do this:

    var data =  ['red', 'green', 'blue'];
    var dataComponent = [];
    data.forEach(function (dataValue) {
        dataComponent.push(
    {dataValue}
    ); });

    And now you can return the dataComponent.

提交回复
热议问题