Skip to content

Releases: astoilkov/use-local-storage-state

16.0.0

14 Mar 18:04
Compare
Choose a tag to compare
  • 🔀 🐎 🐛 when ssr: true avoid calling React effects on the first render, resolves #39 #40 #43 762fe4f
  • 🐛 setState() should be stable and not change between renders, resolves #44 47c7715
  • ♻️ improve types and export LocalStorageState type, resolves #42 40a2f0c

v15.0.0...v16.0.0

15.0.0

18 Feb 13:52
Compare
Choose a tag to compare

A new complete rewrite of the library inspired by a discussion in #38 and #37.

v14.0.1...v15.0.0

14.0.1

16 Feb 13:25
Compare
Choose a tag to compare
  • 🐛 hook throws an error on the server, resolves #37 88d4548

v14.0.0...v14.0.1

14.0.0

15 Feb 19:15
Compare
Choose a tag to compare

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).

v14.0.0-0...v14.0.0

14.0.0-0

12 Feb 13:52
Compare
Choose a tag to compare
14.0.0-0 Pre-release
Pre-release

13.0.0

10 Dec 09:17
Compare
Choose a tag to compare
  • 🐛 default value ignores/overwrites previous localStorage state, #33 4cc6388
  • 🔀 return type of hook without a type and default value to be unknown, resolves #32 2f8c0e8

This is a major release because of a change in the TypeScript types — 2f8c0e8.

v12.0.0...v13.0.0

12.0.0

12 Nov 19:34
Compare
Choose a tag to compare

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:

  • a react-dom was added as a peer dependency to fix #31
  • fixing #30 introduces a change that can affect some existing code

v11.0.0...v12.0.0

v11.0.0

02 Sep 12:09
Compare
Choose a tag to compare

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 by useLocalStorageState() and renamed to removeItem(). The naming is now consistent with the localStorage.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

v10.0.0...v11.0.0

10.0.0

22 May 06:56
Compare
Choose a tag to compare
  • 🔀 state is not persisted to LS during initial render with defaultValue — fixes #26 8607f33

v9.0.2...v10.0.0

v9.0.2

07 Feb 17:59
Compare
Choose a tag to compare
  • 🏗 🐛 es folder wasn't actually published 9fa7ed0

v9.0.1...v9.0.2