import React from "react"; import Api from "../Api"; /** * Context lets us pass a value deep into the component tree * without explicitly threading it through every component. * ApiContext used to context API component. * * @author Robert Long */ export const ApiContext = React.createContext(undefined); /** * withApi used to provide component context value by calling api. * * @author Robert Long */ export function withApi(Component) { return function ApiContextComponent(props) { return ( {api => api ? : } ); }; }