Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/netzo/deps/usehooks-ts.ts>useMap

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Go to Latest
function useMap
import { useMap } from "https://deno.land/x/netzo@0.5.63/deps/usehooks-ts.ts";

Custom hook for managing a key-value map state with setter actions.

Examples

const [map, mapActions] = useMap(); // Access the map state and use mapActions to set, remove, or reset entries.

Type Parameters

K
  • The type of keys in the map.
V
  • The type of values in the map.

Parameters

optional
initialState: MapOrEntries<K, V>
  • The initial state of the map as a Map or an array of key-value pairs (optional).

Returns

Return<K, V>

A tuple containing the map state and actions to interact with the map.