1
현재 반응 알림을 구현 중이지만 Cannot read property 'preventDefault' of undefined
이라는 오류가 발생하여 _addNotification에 전달되는 이벤트가 정의되지 않았다고 생각됩니다.반응 알림을 찾을 수 없습니다.
_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
},
감사합니다. 이것으로 문제가 해결되지만, '속성을 읽을 수 없습니다'라는 addNotification 'of null'이라는 메시지가 나오는데 이는 null _notificationSystem에 알림을 추가하지 않는다는 것을 의미합니다. 그러나 이는 문서 [여기] (https://github.com/igorprado/react-notification-system#creating-a-notification)에 반하는 것으로 보입니다. 이것은 또한 빠른 수정이거나 자신의 질문을받을 만한지 확실하지 않습니다. –