在React中触发jQuery事件

在React中触发jQuery事件,jquery,reactjs,Jquery,Reactjs,如何在React应用程序中启动axios回调 jQuery('body').trigger({ type: 'action', event: 'submit', value: 'success' }); 编辑: 基本上,我需要调用React到一个遗留jQuery实现中,该实现需要类似上面示例的pub-sub模式。使用React中的键盘事件-例如: var CommentForm = React.createClass({ handleSubmit: function

如何在React应用程序中启动axios回调

jQuery('body').trigger({
    type: 'action',
    event: 'submit',
    value: 'success'
});
编辑:
基本上,我需要调用React到一个遗留jQuery实现中,该实现需要类似上面示例的pub-sub模式。

使用React中的键盘事件-例如:

var CommentForm = React.createClass({
  handleSubmit: function(e) {
    alert("YES again");
    return;
  },  
  handleKeyPress: function(e){console.log(e.which);if(e.which == 13){this.handleSubmit();}},
  render: function() {
    return (
        <div className="postCon">
          <form className="commentForm" onSubmit={this.handleSubmit}>
            <textarea onKeyPress={this.handleKeyPress} className="textA input" placeholder="Your comment" ref="author" />
          </form>
        </div>
    );
  }
})
var CommentForm=React.createClass({
handleSubmit:函数(e){
警惕(“再次是”);
返回;
},  
handleKeyPress:function(e){console.log(e.which);if(e.which==13){this.handleSubmit();},
render:function(){
返回(
);
}
})

使用React中的键盘事件-例如:

var CommentForm = React.createClass({
  handleSubmit: function(e) {
    alert("YES again");
    return;
  },  
  handleKeyPress: function(e){console.log(e.which);if(e.which == 13){this.handleSubmit();}},
  render: function() {
    return (
        <div className="postCon">
          <form className="commentForm" onSubmit={this.handleSubmit}>
            <textarea onKeyPress={this.handleKeyPress} className="textA input" placeholder="Your comment" ref="author" />
          </form>
        </div>
    );
  }
})
var CommentForm=React.createClass({
handleSubmit:函数(e){
警惕(“再次是”);
返回;
},  
handleKeyPress:function(e){console.log(e.which);if(e.which==13){this.handleSubmit();},
render:function(){
返回(
);
}
})

添加了更多详细信息,也许现在我需要做的事情已经很清楚了。如果您认为此答案有助于将此标记为正确答案,以便其他人可以受益:)添加了更多详细信息,也许现在我需要做的事情已经很清楚了。如果您认为此答案有助于您将此标记为正确答案,以便其他人可以受益:)