Skip to content

Commit

Permalink
Rename persistence hooks and update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
theninthsky committed Aug 23, 2023
1 parent 426b7f6 commit 90ef86a
Show file tree
Hide file tree
Showing 9 changed files with 459 additions and 410 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
- [useFetch](#usefetch)
- [useMedia](#usemedia)
- [useObjectState](#useobjectstate)
- [usePersistedState](#usepersistedstate)
- [usePersistedObjectState](#usepersistedobjectstate)
- [usePersistState](#usepersiststate)
- [usePersistObjectState](#usepersistobjectstate)
- [useProgressiveImage](#useprogressiveimage)
- [useTransitionNavigate](#usetransitionnavigate)
- [Utility Functions](#utility-functions)
Expand Down Expand Up @@ -221,12 +221,12 @@ return (
)
```

## usePersistedState
## usePersistState

Allows you to keep your current state between rerenders:

```js
const [posts, setPosts] = usePersistedState('posts', [])
const [posts, setPosts] = usePersistState('posts', [])

// will store the state in memory for the next mount
setPosts([
Expand All @@ -235,12 +235,12 @@ setPosts([
])
```

## usePersistedObjectState
## usePersistObjectState

The combination of `usePersistedState` and `useObjectState`:
The combination of `usePersistState` and `useObjectState`:

```js
const [form, setForm, resetForm] = usePersistedObjectState(
const [form, setForm, resetForm] = usePersistObjectState(
'student',
{
name: '',
Expand Down
Loading

0 comments on commit 90ef86a

Please sign in to comment.