pure-react-event-bus
v1.0.0
Published
React specified event bus
Downloads
4
Readme
react-mitt-wrapper
React event bus
Install
npm install --save react-event-bus
Usage
import React, {Component} from 'react'
import {useEventBusOn} from 'react-mitt-wrapper'
export function App() {
return <MittProvider>
<Foo />
</MittProvider>
}
export function Foo() {
useEventBusOn('myEvent', (eventData) => {
console.log(eventData)
})
return <></>
}
Hooks
useEventBus()
– retrieve event bus instance
useEventBusOn(eventKey, listener)
– assign specific listener function to event
useEventBusPiblish()
– uses for publishing events
License
MIT © dkildar