UNPKG

@ohm-vision/react-storage

Version:

Extension to React to interact with native Window Storage object

16 lines (15 loc) 416 B
import { useStorage } from "./use-storage"; /** * Default number storage which defaults the `convert` to number initializers * @param props * @returns */ export function useNumberStorage(props) { if (!props.convert) { props.convert = { fromStorage: function (v) { return +v; }, toStorage: function (v) { return v.toString(); } }; } return useStorage(props); }