jollyjerr / react-autosave

Component or hook to auto save controlled form values as they are updated
https://www.npmjs.com/package/react-autosave
MIT License
65 stars 2 forks source link

onSave is called if onSave changes. Can this be optional? #17

Closed mspangl5 closed 2 years ago

mspangl5 commented 2 years ago

My onSave callback needs to verify against a state value that changes often. But if I put that state value as a dependency to the useCallback, it will create a new callback each time that state value changes and then useAutosave will call onSave. I would like to silently update onSave without triggering useAutosave to call it.

jollyjerr commented 2 years ago

Hi! Sounds good - that behavior would probably make more sense as the default anyway. I'll update asap - but PR's are always welcome in the meantime!