Document useReactiveState
This commit is contained in:
1 parent
fbc72283d4
commit
1fc181dc28
1 file changed
+5
@@ -23,6 +23,11 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
} from "react";
|
} 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 = <T>(
|
export const useReactiveState = <T>(
|
||||||
updateFn: (prevState?: T) => T,
|
updateFn: (prevState?: T) => T,
|
||||||
deps: DependencyList
|
deps: DependencyList
|
||||||
|
|||||||
Reference in new issue
Block a user