back
loading skill details...
Create a library-grade Vue composable that accepts maybe-reactive inputs (MaybeRef / MaybeRefOrGetter) so callers can pass a plain value, ref, or getter.…
Create Adaptable Composable Adaptable composables are reusable functions that can accept both reactive and non-reactive inputs. This allows developers to use the composable in a variety of contexts without worrying about the reactivity of the inputs. Steps to design an adaptable composable in Vue.js: Confirm the composable's purpose and API design and expected inputs/outputs. Identify inputs params that should be reactive (MaybeRef / MaybeRefOrGetter). Use toValue() or toRef() to normalize inputs inside reactive effects. Implement the core logic of the composable using Vue's reactivity APIs. Core Type Concepts Type Utilities /** * value or writable ref (value/ref/shallowRef/writable computed) */ export type MaybeRef<T = any> = T | Ref<T> | ShallowRef<T> | WritableComputedRef<T>;
don't have the plugin yet? install it then click "run inline in claude" again.