UNPKG

react-http-fetch

Version:

An http library for React JS built on top of native JS fetch

11 lines (10 loc) 291 B
import { createContext, useContext } from 'react'; import { EventBus } from './event-bus'; var eventBus = new EventBus(); /** * The EventBus context. */ export var EventBusContext = createContext(eventBus); export var useEventBus = function () { return useContext(EventBusContext); };