Last active
March 29, 2024 11:22
-
-
Save TheLucifurry/8e6c6b0ec6187ead3686b15cf932086b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ref } from 'vue' | |
/** | |
* Creates a reactive Map | |
* Allows access without using ".value", | |
* as opposed to directly declaring `ref(new Map())`, | |
* while retaining reactivity when using its methods | |
*/ | |
export function useMap<K, V>(...args: ConstructorParameters<typeof Map<K, V>>) { | |
return ref(new Map<K, V>(...args)).value as Map<K, V> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment