React hook to subscribe and dispatch events across React components.
Github: https://github.com/fabienjuif/use-bus
Register to an event (and react to it)
- Import the hook useBus.
- Register to an event name, here @@ui/ADD_ITERATION.
- React to this, here an anonymous function that increment a number.
Dispatch an event
- Import dispatch and call it with the event you want to send.