我有兩個相鄰的React模塊,它們將用戶從另一個模塊中添加/刪除。如果所有用戶已從「刪除用戶」模塊中刪除,返回通知的最佳方法是什麼。例如,這裏是我的模塊,用戶被刪除:有條件的React模塊內部
var React = require('react');
module.exports = React.createClass({
handleRemove: function() {
this.props.onRemove(this.props.user.id);
},
render: function() {
return (
<div className="col-md-6">
<div className="selected-user">
<p onClick={this.handleRemove}>{this.props.user.first_name} {this.props.user.last_name}<i onClick={this.handleRemove} className="fa fa-close"></i></p>
</div>
</div>
)
}
})
因此,如果有在「選擇用戶」 div中沒有用戶,我想返回「您還沒有選擇任何用戶」。我想知道在模塊內部做什麼最有效的方法。