rescript-asyncdata
Advanced tools
| *.res linguist-language=ReScript | ||
| *.resi linguist-language=ReScript |
+6
-0
@@ -0,1 +1,7 @@ | ||
| # 2.0.0 | ||
| Changes: | ||
| - Remove paginated hook for now (347bfc9) | ||
| # 1.1.1 | ||
@@ -2,0 +8,0 @@ |
+1
-1
| { | ||
| "name": "rescript-asyncdata", | ||
| "version": "1.1.1", | ||
| "version": "2.0.0", | ||
| "scripts": { | ||
@@ -5,0 +5,0 @@ "clean": "bsb -clean-world", |
+1
-18
@@ -131,2 +131,3 @@ # AsyncData | ||
| Return a record containing: | ||
| - `current`: after initial load, guaranteed to keep a `Done` state | ||
@@ -154,22 +155,4 @@ - `next`: the reload request | ||
| ### useAsyncPaginatedData | ||
| Simple async data with support for pagination. | ||
| Takes a `merge` function so that you can aggregate pages. | ||
| Return a record containing: | ||
| - `current`: after initial load, guaranteed to keep a `Done` state containing the aggregated data | ||
| - `next`: the next page request | ||
| ```reason | ||
| let (data, setData) = useAsyncPaginatedData(~merge=Array.concat, ()) // {current: NotAsked, next: NotAsked} | ||
| setData(Loading) // {current: Loading, next: Loading} | ||
| setData(Done([1, 2, 3])) // {current: Done([1, 2, 3]), next: Done([1, 2, 3])} | ||
| setData(Loading) // {current: Done([1, 2, 3]), next: Loading} | ||
| setData(Done([4, 5, 6])) // {current: Done([1, 2, 3, 4, 5, 6]), next: Done([4, 5, 6])} | ||
| ``` | ||
| ## 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
14
7.69%25200
-16.44%157
-9.77%