We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent da7cd8c commit d107da5Copy full SHA for d107da5
1 file changed
packages/plugin/src/usePersistentState.ts
@@ -9,6 +9,14 @@ import {
9
import { nanoid } from 'nanoid';
10
import { PersistentStateContext } from './PersistentStateContext';
11
12
+/**
13
+ * Functions identically to useState except that a PersistentStateProvider can be used to
14
+ * track all calls to this hook and persist the value for future page loads.
15
+ * Primarily used in Deephaven UI so we can persist state of multiple components within a panel.
16
+ *
17
+ * @param initialState The initial state if there is no previously persisted state.
18
+ * @returns [state, setState] tuple just like useState.
19
+ */
20
export default function usePersistentState<S>(
21
initialState: S | (() => S)
22
): [S, Dispatch<SetStateAction<S>>] {
0 commit comments