Javascript 反应日期选择器在单击外部时隐藏已断开

Javascript 反应日期选择器在单击外部时隐藏已断开,javascript,angularjs,reactjs,Javascript,Angularjs,Reactjs,我正在尝试根据控制器中的数组更新我的react组件。在控制器中,我正在合并日记并更改其内容,但我无法更新react组件中的视图。有人可以解释我如何从控制器更新react状态吗?谢谢 var app=angular.module('app',['react']) 我的反应组件 var DiaryResult = React.createClass({ getInitialState: function() { return { items : thi

我正在尝试根据控制器中的数组更新我的react组件。在控制器中,我正在合并日记并更改其内容,但我无法更新react组件中的视图。有人可以解释我如何从控制器更新react状态吗?谢谢

var app=angular.module('app',['react'])

我的反应组件

var DiaryResult = React.createClass({
    getInitialState: function() {
        return {
            items : this.props.item,
        };
    },
  init:function () {
    this._super.apply(this,arguments);
      if (this.get("props")) {
          this.get('props').set(this.get("resultProps") || "default", this);
      }
  },
    render: function(){
        var arrayItems =  this.state.items.map(function (item,i) {
            return (
                <tr key={i}>
                    <td><FormattedDate value={item.start}/></td>
                    <td><FormattedDate value={item.end}/></td>
                    <td>{item.hours}</td>
                </tr>
            );
        }.bind(this));
        return (
            <table className="resultTable">
                <thead>
                <tr>
                    <th>Start Date:</th>
                    <th>End Date:</th>
                    <th id="hoursField">Hours:</th>
                </tr>
                </thead>
                <tbody>
                {arrayItems}
                </tbody>
                <tfoot>

                </tfoot>
            </table>
        );
    }
});
var DiaryResult=React.createClass({
getInitialState:函数(){
返回{
项目:this.props.item,
};
},
init:函数(){
这个._super.apply(这个,参数);
如果(这个。获取(“道具”)){
this.get('props').set(this.get(“resultProps”)| |“default”,this);
}
},
render:function(){
var arrayItems=this.state.items.map(函数(item,i){
返回(
{item.hours}
);
}.约束(这个);
返回(
开始日期:
结束日期:
小时:
{arrayItems}
);
}
});
还有我的html

body  ng-app="app" ng-controller="MainCtrl as mainCtrl">


<div class="tableWrapper">
<react-component name="DiaryTable" props="firstArrayProps" />
</div>

<button class="myButton" id="mergeButton" ng-click="runMerge()">Merge diaries</button>

<div class="tableWrapper">
<react-component name="DiaryTable" props="secondArrayProps" />
</div>

<react-component name="DiaryResult" props="resultProps" />


</body>
body ng app=“app”ng controller=“MainCtrl as MainCtrl”>
合并日记

你为什么同时使用angular和react来运行你的站点?@hamohl因为如果你有一个大型angular项目,你就没有时间和金钱来切换到react。因此,您可以使用React编写组件directive@hamohl还有Angular=MVC和React=C,不帮助男生,哈哈;D
body  ng-app="app" ng-controller="MainCtrl as mainCtrl">


<div class="tableWrapper">
<react-component name="DiaryTable" props="firstArrayProps" />
</div>

<button class="myButton" id="mergeButton" ng-click="runMerge()">Merge diaries</button>

<div class="tableWrapper">
<react-component name="DiaryTable" props="secondArrayProps" />
</div>

<react-component name="DiaryResult" props="resultProps" />


</body>