Devid Farinelli Devid Farinelli - 2 months ago 21
AngularJS Question

Can I replace ng-repeat in my mobile app with a React component?

No matter what I try (

crosswalk
,
track by
,
collection-repeat
,
limitTo
with
infiniteScroll
, one-way binding,
ng-if
), using
ng-repeat
I'm not able to develop a good Ionic1 app.

Since React is a library, can I use a React component in my Ionic1 project instead a non-performant
ng-repeat
?

Which are the pros and cons?

Answer

Yes, using ngReact and the equivalent of a ng-repeat as said here

var List = React.createClass({
    render: function() {
        return (<div>
        { this.props.data.map(function(item) {
                return <div>{item}</div>
            })
        }
        </div>);
    }
});
Comments