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

react-data-fetch

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-data-fetch

A good-enough data fetching mixin for React components

  • 0.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by100%
Maintainers
3
Weekly downloads
 
Created
Source

react-data-fetch Build Status Coverage Status

A good-enough data fetching mixin for React components. No models, no stores, just data.

Bare functionality for fetching server-side JSON data inside a React omponent. Uses basic Ajax requests and setInterval for polling.

{
  "component": "List",
  "dataUrl": "/api/users.json",
  // Refresh users every 5 seconds
  "pollInterval": 5000
}

Props:

  • dataUrl - A URL to fetch data from. Once data is received it will be set inside the component's state, under the data key, and will cause a reactive re-render.
  • pollInterval - An interval in milliseconds for polling the data URL. Defaults to 0, which means no polling.

Context methods:

  • getDataUrl: The data URL can be generated dynamically by composing it using other props, inside a custom method that receives the next props as arguments and returns the data URL. The expected method name is "getDataUrl" and overrides the dataUrl prop when implemented.

The DataFetch mixin introduces a jQuery dependency, its built-in JSONP support is worth the money.

FAQs

Package last updated on 25 May 2017

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