I have web application that is written in AngularJs 1.x so i have decided to convert it into either AngularJs2 or ReactJs+AngualrJs2. Reason to choosed ReactJs was that it is rendered faster than AngualrJs and i choosed AnguarJs was that it's two way data binding and i can keep my legacy model as it is and data bind into ReactJs components.I prefer AngualrJs data model over flux.I am deciding to create reuslable HTML components in ReactJs and bind AngularJs model data into it.
Sample Code Snippet using AngualrJs + ReactJs
angular.module('app').directive('greeting',[function(){
return {
restrict:'AE',
scope:{name:'@'},
link: function (scope, elem, attrs){
var GreetingSection = React.createClass({displayName: 'Greeting',
render: function() {
var message = "Good morning " + this.props.data.name + ", how are you?";
return React.createElement('div', {className: "greeting"},message);
}
});
React.renderComponent(GreetingSection({data:scope}), elem[0]);
}
};
}]);
My questions are,
- Are there any performance benefits if i combined AngualrJs(2.x or 1.x) with ReactJs components?
- Can i achieve faster rendering using AngularJs 2.x without ReactJs?
Please help me to take an decision.