You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
react-autosave is an extremely lightweight component that periodically triggers an async callback function if, and only if, the value to update has changed.
37
49
38
50
## Features
39
51
40
-
1. Written in typescript. Generic Typescript support out of the box.
52
+
1. Written in typescript.
41
53
42
-
2.Callback props for successful and failed api calls.
54
+
2.Lightweight and simple.
43
55
44
-
3.Lightweight and simple.
56
+
3.No external libraries.
45
57
46
58
## API
47
59
48
-
| Prop | Type | Description |
49
-
|---------- |:-------------: |-------------:|
50
-
| data | T | The controlled form value to be auto saved |
51
-
| onSave | (data: T) => Promise | The callback function to save your data |
52
-
| interval (optional) | number | The number of milliseconds between save attempts. Defaults to 2000 |
53
-
| onError (optional) | Function | A callback function for if the save function errors |
54
-
| onSuccess (optional) | Function | A callback function for if the save function resolves
0 commit comments