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

react-fetch-hook

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-fetch-hook - npm Package Compare versions

Comparing version 1.6.2 to 1.6.3

10

package.json
{
"name": "react-fetch-hook",
"version": "1.6.2",
"version": "1.6.3",
"description": "React fetch hook",

@@ -13,2 +13,3 @@ "scripts": {

"run:example:depends": "parcel ./examples/depends/index.html",
"run:example:pagination": "parcel ./examples/pagination/index.html --no-cache",
"prepublish": "npm run flow:check && npm run typescript && npm run lint && npm run size && npm run test"

@@ -40,3 +41,3 @@ },

],
"limit": "186 B",
"limit": "227 B",
"path": "usePaginatedRequest.js"

@@ -60,4 +61,3 @@ }

"flow:check",
"test",
"size"
"test"
],

@@ -85,2 +85,3 @@ "repository": {

"@babel/core": "^7.2.2",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.2.0",

@@ -114,2 +115,3 @@ "@babel/preset-flow": "^7.0.0",

"react-dom": "^16.8.0",
"react-infinite-scroller": "^1.2.4",
"react-test-renderer": "^16.8.0",

@@ -116,0 +118,0 @@ "react-testing-library": "^6.0.0",

31

README.md

@@ -130,30 +130,3 @@ # react-fetch-hook

### Paginated requests
```javascript
import React from "react";
import usePaginatedRequest from "react-fetch-hook/usePaginatedRequest";
import fetchSomeData from "..."
const Component = () => {
const results = usePaginatedRequest(
({limit, offset}) => fetchSomeData(limit, offset),
20
);
return (
<InfiniteScroll
pageStart={0}
loadMore={results.loadMore}
hasMore={results.hasMore}
loader={<div />}>
{results.data && results.data.map((item) => {
...
})}
</InfiniteScroll>)
}
```
## API

@@ -205,3 +178,5 @@

### `usePaginatedRequest`
### Experimental: `usePaginatedRequest`
⚠️ Warning: this method is experimental, API can be changed.
Create a paginated request.

@@ -208,0 +183,0 @@ ```javascript

@@ -7,2 +7,3 @@ var React = require('react')

) {
var depends = Array.prototype.slice.call(arguments, [2])
var dataState = React.useState([])

@@ -15,2 +16,8 @@ var currentUpdate = React.useRef()

React.useEffect(function () {
dataState[1]([])
offsetState[1](0)
hasMoreState[1](true)
}, depends)
React.useEffect(

@@ -34,3 +41,3 @@ function () {

},
[offsetState[0]]
[offsetState[0]].concat(depends)
)

@@ -37,0 +44,0 @@

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