Skip to content

Commit d107da5

Browse files
committed
Comment
1 parent da7cd8c commit d107da5

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

packages/plugin/src/usePersistentState.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ import {
99
import { nanoid } from 'nanoid';
1010
import { PersistentStateContext } from './PersistentStateContext';
1111

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+
*/
1220
export default function usePersistentState<S>(
1321
initialState: S | (() => S)
1422
): [S, Dispatch<SetStateAction<S>>] {

0 commit comments

Comments
 (0)