@excentone/spfx-react
Version:
Contains custom ReactJs components and hooks intended to use when developing SharePoint Framework (SPFx) Web components.
49 lines (48 loc) • 1.14 kB
TypeScript
import { ActionWithoutArgs } from "@excentone/spfx-utilities";
import { Dispatch, SetStateAction } from "react";
/**
* Options available for `useCounter`.
*/
export interface ICounterHookOptions {
/**
* The initial value of the counter.
*/
initialValue?: number;
/**
* The default value of the counter.
*/
defaultValue?: number;
/**
* The max value of the counter.
*/
maxValue?: number;
}
/**
* Operations available for `useCounter`.
*/
export interface ICounterHookOperations {
/**
* Sets the value of the counter.
*/
set: Dispatch<number>;
/**
* Resets the value of the counter.
*/
reset: ActionWithoutArgs;
/**
* Increments the value of the counter.
*/
increment: ActionWithoutArgs;
/**
* Decrements the value of the counter.
*/
decrement: ActionWithoutArgs;
/**
* Sets the max value limit of the counter.
*/
setMax: Dispatch<SetStateAction<number>>;
}
/**
* The type returned by `useCounter` custom hook.
*/
export declare type CounterHook = readonly [number, ICounterHookOperations];