I've got a method addNotification() at App.js which I want to reuse in some of my other components. Here I used AgencyProfile component for example. It doesn't work if I export the addNotification() method from App.js. How can I call the method addNotification() from other child components, here for example AgencyProfile? here is my App.js code
export class App extends React.Component{
.....
addNotification(title, message, level, time) {
let dismiss = (time === undefined) ? 0 : time;
this.notification.addNotification({
title: title,
message: message,
level: level,
autoDismiss: dismiss
});
}
.......
render() {
return (
<div>
<NotificationSystem ref={ref => this.notification = ref}/>
<AgencyProfile />
</div>
);
}
}