diff --git a/docs/useMap.md b/docs/useMap.md index cf3273afe3..7210076a1e 100644 --- a/docs/useMap.md +++ b/docs/useMap.md @@ -18,7 +18,10 @@ const Demo = () => { Add reset()}> - Reset + Reset to initial + + reset({hello: 'different'})}> + Reset with new object remove('hello')} disabled={!map.hello}> Remove 'hello' diff --git a/src/useMap.ts b/src/useMap.ts index 236ac177e6..ecc9f8da3a 100644 --- a/src/useMap.ts +++ b/src/useMap.ts @@ -27,7 +27,7 @@ const useMap = (initialMap: T = {} as T): [T, Actions return rest as T; }); }, - reset: () => set(initialMap), + reset: (newMap = initialMap) => set(newMap), }), [set] );