withFetcher

The HOC creatation function

withFetcher
Parameters
Success (React.Component) component to populate after the data is fetched
config (object = {})
Name Description
config.Loading React.Component (default null) component to show while data is being fetched
config.Failed React.Component (default null) component to show if the fetch fails
config.TimedOut React.Component (default null) component to show if the fetch take too long
config.debug boolean (default false) log extra info
config.log function (default console.log) loggin function
config.always_fail boolean (default false) always render Failed component (for testing and debugging)
config.simulate_lag number (default 0) set a timeout to simualte network lag (for testing and debugging)
config.singleton boolean (default false) return first element of fetched array

WithFetcher

The returned HOC Fetching component

new WithFetcher(props: object)

Extends React.Component

Parameters
props (object)
Name Description
props.url string the url to fetch
props.getFunc string the fetching function
props.timeout number (default 0) how many ms to declare timed out condition
props.url_config object? config to be passed to getFunc
props.onFetched function? onFetched(response)
props.onFailed function? onFailed(error)