A react hook to manage state in a key value pair map.
Argument value | Type | Description | Defualt |
---|---|---|---|
initialValue | Object | Initial value of the map | undefined |
Returns an array of following items:
Return value | Type | Description |
---|---|---|
map | any | value of the map |
methods | Object | methods to modify the map, see the table below |
map methods:
Return value | Type | Description |
---|---|---|
set | (key: any, value: any) => void | set a key value pair in map |
has | (key: any) => boolean | if key exists in map |
setMultiple | (...keys: any[]) => void | set multiple key value pair in map |
remove | (key: any) => void | remove a key value pair in map |
removeMultiple | (...keys: any[]) => void | remove multiple key value pair in map |
removeAll | () => void | remove all key value pair in map |
Join our discord server! You can click the floating discord icon at the bottom right of the screen and chat with us!