From 1fc181dc280bf6341dccf7dc781e281bb27359d3 Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Wed, 15 Feb 2023 16:38:49 -0500 Subject: [PATCH] Document useReactiveState --- src/useReactiveState.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/useReactiveState.ts b/src/useReactiveState.ts index f20399a..5693be5 100644 --- a/src/useReactiveState.ts +++ b/src/useReactiveState.ts @@ -23,6 +23,11 @@ import { useState, } from "react"; +/** + * Hook creating a stateful value that updates automatically whenever the + * dependencies change. Or equivalently, a version of useMemo that takes its own + * previous value as an input, and can be updated manually. + */ export const useReactiveState = ( updateFn: (prevState?: T) => T, deps: DependencyList