1
現在、反応通知を実装していますが、_addNotificationに渡されるイベントが定義されていないことを意味するCannot read property 'preventDefault' of undefined
というエラーが発生しています。反応通知を見つけることができません
_handleSuccess: function(data, status, jqXHR) {
this._addNotification()
this.setState({
errors: {},
loading: false
});
},
_notificationSystem: null,
_addNotification: function(event) {
event.preventDefault()
this._notificationSystem.addNotification({
message: 'Notification message',
level: 'success',
position: 'bc'
});
},
_componentDidMount: function() {
this._notificationSystem = this.refs.notificationSystem;
},
_getNotificationSystemInstance: function() {
return this
},
ありがとうございました!これは問題を解決しますが、 'Can not read property 'のaddNotification' of null'というフォローアップの問題を提示します。これは、null _notificationSystemに通知を追加しないことを意味します。しかし、これはドキュメンテーション[ここ](https://github.com/igorprado/react-notification-system#creating-a-notification)に反するようです。これも迅速な修正であるのか、それとも自分自身の質問に値するのかはっきりしない。 –