/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Widget
 */
import { assert } from "@itwin/core-bentley";
import * as React from "react";
import { TabIdContext, useTabTransientState, } from "../layout/widget/ContentRenderer";
/** Hook that allows to save and restore transient DOM state (i.e. scroll offset) of a widget.
 * @beta
 */
export function useTransientState(onSave, onRestore) {
    const tabId = React.useContext(TabIdContext);
    assert(!!tabId);
    return useTabTransientState(tabId, onSave, onRestore);
}
//# sourceMappingURL=useTransientState.js.map