UNPKG

@ohm-vision/react-storage

Version:

Extension to React to interact with native Window Storage object

16 lines (15 loc) 417 B
import { useStorage } from "./use-storage"; /** * Default boolean storage which defaults the `convert` to a boolean initializer and string saver * @param props * @returns */ export function useBooleanStorage(props) { if (!props.convert) { props.convert = { fromStorage: Boolean, toStorage: function (v) { return v.toString(); } }; } return useStorage(props); }