/** * Custom hook to manage state with local storage. * * @param {string} key - The key for the local storage. * @param {T} initialState - The initial state value. * @param {Object} [options] - Optional settings. * @param {boolean} [options.initializeWithValue=true] - Whether to initialize the local storage with the initial state value. * * @returns {UseLocalStorageReturn} - An object containing: * - `state`: The current state. * - `resetState`: A function to reset the state to the initial value and remove it from local storage. * - `setState`: A function to update the state and save it to local storage. * - `setField`: A function to update a specific field in the state and save it to local storage. * * @example * const { state, resetState, setState, setField } = useLocalStorage('settings', initialState); * * return ( *
*

State: {JSON.stringify(state)}

* * * *
* ); */ type UseLocalStorageOptions = { initializeWithValue?: boolean; }; type UseLocalStorageReturn = { state: T; resetState: (defaultState?: T) => void; setState: (updateState: T | Partial) => void; setField: (name: keyof T, updateValue: T[keyof T]) => void; }; declare function useLocalStorage(key: string, initialState?: T, options?: UseLocalStorageOptions): UseLocalStorageReturn; export { type UseLocalStorageOptions, type UseLocalStorageReturn, useLocalStorage };