New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

rescript-asyncdata

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rescript-asyncdata - npm Package Compare versions

Comparing version
3.0.0
to
4.0.0
+6
-0
HISTORY.md

@@ -0,1 +1,7 @@

# 4.0.0
Changes:
- Don't expose React hooks (b8737eb)
# 3.0.0

@@ -2,0 +8,0 @@

+2
-4
{
"name": "rescript-asyncdata",
"version": "3.0.0",
"version": "4.0.0",
"scripts": {

@@ -16,2 +16,3 @@ "clean": "bsb -clean-world",

"devDependencies": {
"@rescript/react": "^0.10.1",
"bs-platform": "^8.3.2",

@@ -22,6 +23,3 @@ "moduleserve": "^0.9.1",

"rescript-test": "^0.6.3"
},
"dependencies": {
"@rescript/react": "^0.10.1"
}
}

@@ -112,46 +112,4 @@ # AsyncData

## React hooks
This library provides a `ReactAsyncData` module that contains some usefull hooks:
### useAsyncData
Simple async data
```reason
let (data, setData) = useAsyncData() // NotAsked
setData(Loading) // Loading
setData(Done(1)) // Done(1)
```
### useAsyncReloadData
Simple async data with support for reload.
Return a record containing:
- `current`: after initial load, guaranteed to keep a `Done` state
- `next`: the reload request
```reason
let (data, setData) = useAsyncReloadData() // {current: NotAsked, next: NotAsked}
setData(Loading) // {current: Loading, next: Loading}
setData(Done(1)) // {current: Done(1), next: Done(1)}
setData(Loading) // {current: Done(1), next: Loading}
setData(Done(2)) // {current: Done(2), next: Done(2)}
```
Takes an optional `merge` to define how to set `current` when receiving a new `Done(x)` .
That can be useful if you want to compare the original and newly received data.
```reason
let (data, setData) = useAsyncReloadData(~merge=(a, _b) => a, ()) // {current: NotAsked, next: NotAsked}
setData(Loading) // {current: Loading, next: Loading}
setData(Done(1)) // {current: Done(1), next: Done(1)}
setData(Loading) // {current: Done(1), next: Loading}
setData(Done(2)) // {current: Done(1), next: Done(2)}
```
## Aknowledgments
This is heavily inspired by Elm's [krisajenkins/remotedata](https://github.com/krisajenkins/remotedata)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet