@ohm-vision/react-storage
Version:
Extension to React to interact with native Window Storage object
16 lines (15 loc) • 424 B
JavaScript
import { useStorage } from "./use-storage";
/**
* Default string storage which defaults the `convert` to just pass back and forth the raw object
* @param props
* @returns
*/
export function useStringStorage(props) {
if (!props.convert) {
props.convert = {
fromStorage: function (v) { return v; },
toStorage: function (v) { return v; }
};
}
return useStorage(props);
}