From d4e671dfca513a95b4bb28f4634f5d0c4b222e18 Mon Sep 17 00:00:00 2001 From: suisous <154897670+suisous@users.noreply.github.com> Date: Fri, 5 Jan 2024 15:07:04 +0900 Subject: [PATCH] Update useSet docs --- docs/useSet.md | 8 +++++++- stories/useSet.story.tsx | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/useSet.md b/docs/useSet.md index 554072023b..66b9cc0d9f 100644 --- a/docs/useSet.md +++ b/docs/useSet.md @@ -4,16 +4,22 @@ React state hook that tracks a [Set](https://developer.mozilla.org/en-US/docs/We ## Usage +What is the difference between the "clear()" method and the "reset()" method? + +The "reset()" method returns the "Set" to the initial value passed during "useSet +The "clear()" method completely empties the "Set". + ```jsx import {useSet} from 'react-use'; const Demo = () => { - const [set, { add, has, remove, toggle, reset }] = useSet(new Set(['hello'])); + const [set, { add, has, remove, toggle, reset, clear }] = useSet(new Set(['hello'])); return (
+ diff --git a/stories/useSet.story.tsx b/stories/useSet.story.tsx index 82c298ad29..197d996af7 100644 --- a/stories/useSet.story.tsx +++ b/stories/useSet.story.tsx @@ -4,12 +4,13 @@ import { useSet } from '../src'; import ShowDocs from './util/ShowDocs'; const Demo = () => { - const [set, { add, has, remove, reset, toggle }] = useSet(new Set(['hello'])); + const [set, { add, has, remove, reset, clear, toggle }] = useSet(new Set(['hello'])); return (
+