Skip to content

Commit

Permalink
fix: actualize description a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
xobotyi committed Oct 22, 2022
1 parent 6a17640 commit e5b56a2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
15 changes: 8 additions & 7 deletions src/useLocalStorageValue/__docs__/story.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ Manages a single LocalStorage key.
> Does not allow usage of `null` value, since JSON allows serializing `null` values - it would be
> impossible to separate null value fom 'no such value' API result which is also `null`.
> While using SSR, to avoid hydration mismatch, consider setting `initializeWithValue` option
> to `false` - this will yield `undefined` state on first render and defer value fetching until effects
> are executed.
> Due to support of SSR this hook returns undefined on first render even if value is there, to avoid
> this behavior set the `initializeWithValue` option to true.
#### Example

Expand Down Expand Up @@ -60,8 +59,10 @@ function useLocalStorageValue<T>(

#### Return

0. **value** - LocalStorage value of the given `key` argument or `defaultValue`, if the key was not
Object with following properties. Note that this object changes with value while its methods are
stable between renders, thus it is safe to pass them as props.
- **value** - LocalStorage value of the given `key` argument or `defaultValue`, if the key was not
present.
1. **set** - Method to set a new value for the managed `key`.
2. **remove** - Method to remove the current value of `key`.
3. **fetch** - Method to manually retrieve the value of `key`.
- **set** - Method to set a new value for the managed `key`.
- **remove** - Method to remove the current value of `key`.
- **fetch** - Method to manually retrieve the value of `key`.
15 changes: 8 additions & 7 deletions src/useSessionStorageValue/__docs__/story.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ Manages a single SessionStorage key.
> Does not allow usage of `null` value, since JSON allows serializing `null` values - it would be
> impossible to separate null value fom 'no such value' API result which is also `null`.
> While using SSR, to avoid hydration mismatch, consider setting `initializeWithValue` option
> to `false` - this will yield `undefined` state on first render and defer value fetching until effects
> are executed.
> Due to support of SSR this hook returns undefined on first render even if value is there, to avoid
> this behavior set the `initializeWithValue` option to true.
#### Example

Expand Down Expand Up @@ -59,8 +58,10 @@ function useSessionStorageValue<T>(

#### Return

0. **value** - SessionStorage value of the given `key` argument or `defaultValue`, if the key was not
Object with following properties. Note that this object changes with value while its methods are
stable between renders, thus it is safe to pass them as props.
- **value** - SessionStorage value of the given `key` argument or `defaultValue`, if the key was not
present.
1. **set** - Method to set a new value for the managed `key`.
2. **remove** - Method to remove the current value of `key`.
3. **fetch** - Method to manually retrieve the value of `key`.
- **set** - Method to set a new value for the managed `key`.
- **remove** - Method to remove the current value of `key`.
- **fetch** - Method to manually retrieve the value of `key`.

0 comments on commit e5b56a2

Please sign in to comment.