I need to create global custom event, to be able listen and trigger it. In jQuery I would do it like that:
$(document).on('myCustomEvent', function(){
console.log("myCustomEvent triggered");
})
$(document).trigger('myCustomEvent');
What for?
I need to create communication between not related components.
Question:
How to listen and trigger global custom events in ReactJS?