New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-refetcher

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-refetcher

A React hook/component for (re)fetching data.

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

react-refetcher

A React component for (re)fetching data.

NPM

Install

npm install --save react-refetcher

Usage

Render props version

import * as React from 'react'
import { Refetcher } from 'react-refetcher'

class Example extends React.Component {
  render () {
    return (
      <Refetcher url="https://jsonplaceholder.typicode.com/todos" interval={5000}>
        {({ error, result, loading }) => (
          <div>
            {error && 'Error!'}
            {loading && 'Loading...'}
            <ul>
              {result && result.map(todo => (
                <li key={todo.id}>{todo.title}</li>
              ))}
            </ul>
          </div>
        )}
      </Refetcher>
    )
  }
}

Hooks version

import * as React from 'react'
import { useRefetcher } from 'react-refetcher'

function Example() {
  const { error, result, loading } = useRefetcher('https://jsonplaceholder.typicode.com/todos', 5000)
  return (
    <div>
      {error && 'Error!'}
      {loading && 'Loading...'}
      <ul>
        {result && result.map(todo => (
          <li key={todo.id}>{todo.title}</li>
        ))}
      </ul>
    </div>
  )
}

License

MIT © andrevargas

Keywords

FAQs

Package last updated on 22 Mar 2019

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