Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ebi-gene-expression-group/atlas-react-fetch-loader

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ebi-gene-expression-group/atlas-react-fetch-loader

A HOC React component that enables other components to remotely fetch data from an endpoint

  • 3.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-79.17%
Maintainers
3
Weekly downloads
 
Created
Source

Expression Atlas React Fetch Loader

Build Status Coverage Status

A HOC React component that enables other components to remotely fetch data from an endpoint.

Usage

import { withFetchLoader } from '@ebi-gene-expression-group/atlas-react-fetch-loader'
import MyComponent from 'my-component'

const FetchLoadMyComponent = withFetchLoader(MyComponent)

<FetchLoadMyComponent
  host={`https://domain.tld/path/`}
  resource={`json/endpoint`}
  {...passThroughProps} />

Be aware that fields in the JSON data overwrite values passed in as props.

By default, if there’s an error fetching the remote data, instead of the wrapped component an alert Callout will be rendered with a brief description of the underlying error (this is to conform to the EBI Visual Framework). If you want to handle the error yourself you can pass an errorPayloadProvider function prop; it takes an error object as its only argument and returns an arbitrary object which will be destructured and added to the pass-through props. This is especially useful if e.g. you’d like to render an error message within your wrapped component using info such as the error code or a message supplied by the server.

The error object has the following shape:

interface Error {
  description: string;
  name: string;
  message: string;
}

There is a similar prop, loadingPayloadProvider, to replace the animated loading message with your own component. In this case, however, the function has no arguments. As a matter of fact it could be an object, but as a function it’s consistent with errorPayloadProvider.

FAQs

Package last updated on 05 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc