Skip to content

Commit

Permalink
Merge pull request #31 from KrastanD/KrastanD-patch-1
Browse files Browse the repository at this point in the history
Fix persisting-state spelling and grammar
  • Loading branch information
vasucp1207 committed Aug 7, 2023
2 parents c7484db + 6d048a6 commit 4853115
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/quick-start/persisting-state/markdown.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export const markdown = `
# Persisting state value
In this lesson, we take a look at how we can persist the state value to \`localStorage\` with jotai \`atoms\`.
Persisting states to the \`localStorage\` can be challenging, maybe you want to persist user's preferences or data to hand them to users on thier next session.
In this lesson, we will take a look at how we can persist the state value to \`localStorage\` with jotai \`atoms\`.
Persisting state to \`localStorage\` can be challenging. You might want to persist the user's preferences or data for their next session.
Jotai \`atomWithStorage\` is a special kind of atom that automatically syncs the value provided to it with localstorage or sessionStorage, and picks the value upon the first load automatically. It's available in the \`jotai/utils\` module.
To persist our theme atom simply create it with the \`atomWithStorage\` atom.
~~~js
const theme = atomWithStorage('dark', false)
~~~
Now, when you reload the preview section of editor you see that the theme matches with the value before the page reloads.
Now, when you reload the preview section of the editor you will see that the theme matches the value from before the page reload.
`;

0 comments on commit 4853115

Please sign in to comment.