Releases: astoilkov/use-local-storage-state
Releases · astoilkov/use-local-storage-state
16.0.0
15.0.0
14.0.1
14.0.0
This major release is a complete rewrite of the entire library. The results are:
- Hydration mismatch support (it seems it's now the only local storage hook that supports this) — #23. Hydration mismatch can be enabled through the
ssr
option. - Smaller bundle size — from 2.4kb to 1.8kb minified (non gzipped) size.
- Reduced the API to a single method (compared to the two methods previously).
14.0.0-0
13.0.0
12.0.0
This release includes bug fixes.
- 🐛 don't set value to localStorage when defaultValue is undefined, resolve #30 0be1ca4
- 🐛 multiple updates should be batched, resolves #31 a8d884f
It's a major release because:
v11.0.0
This release includes two breaking changes. They affect advanced use cases so most users shouldn't have problems upgrading. I believe these changes will make the library better and would pay off in the long term:
- The
reset()
method have been moved to the third argument returned byuseLocalStorageState()
and renamed toremoveItem()
. The naming is now consistent with thelocalStorage.removeItem()
method. I moved the method because it was confusing to have a method property on a method itself. New usage example:const [value, setValue, { removeItem }] = useLocalStorageState('key')
- The
isPersistent
property is now a property of the third argument and not the argument itself. New usage example:const [value, setValue, { isPersistent }] = useLocalStorageState('key')
Other changes:
- 🐛 Fix an issue where using the array returned by
useLocalStorageState()
as a dependency for an React effect would cause the effect to rerun every time. - ✏️ Update documentation accordingly