Skip to content

Commit

Permalink
docs(use-local-storage): update the serialization option
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Nov 8, 2023
1 parent e5ee4dd commit 61221e2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/src/pages/use-local-storage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,18 @@ const Comp = () => {
*
* Also, the initial value will also be used during the server-side rendering, see below.
*/
'circle'
'circle',
/**
* Optional configuration object enables the customization of value serialization before it's stored in local storage.
*/
{
// Optional, default to false. When set to "true", the value will be passed to the localStorage API as is.
raw: false,
// Optional, default to "JSON.stringify". Can only be specified when the "raw" is set to false (which is the default).
serializer: JSON.stringify,
// Optional, default to "JSON.parse". Can only be specified when the "raw" is set to false (which is the default).
deserializer: JSON.parse,
}
);

return (
Expand Down

0 comments on commit 61221e2

Please sign in to comment.