react-hooks-easy
Version:
Easy use hooks and data linkage
21 lines (17 loc) • 471 B
JSX
import React from 'react'
import InitialStore from "./InitialStore";
export function useObject(namespace, initialValue){
const {value, add, reset, reInitial, del, splice} = InitialStore('object_'+namespace, initialValue);
return {
value,
set: add, // alias
add,
reset,
reInitial,
del,
splice
}
}
export function useMap(namespace, initialValue){
return useObject(namespace, initialValue);
}