From 61221e252dbbcd9cd8db0aac0088a045641b6982 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Wed, 8 Nov 2023 23:41:53 +0800 Subject: [PATCH] docs(use-local-storage): update the serialization option --- docs/src/pages/use-local-storage.mdx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/src/pages/use-local-storage.mdx b/docs/src/pages/use-local-storage.mdx index d86ade07..d5279d02 100644 --- a/docs/src/pages/use-local-storage.mdx +++ b/docs/src/pages/use-local-storage.mdx @@ -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 (