Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/injectLocal.md
1---2category: State3---45# injectLocal67Extended `inject` with ability to call `provideLocal` to provide the value in the same component.89## Usage1011```vue12<script setup>13import { injectLocal, provideLocal } from '@vueuse/core'1415provideLocal('MyInjectionKey', 1)16const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 117</script>18```1920## Type Declarations2122```ts23/**24* On the basis of `inject`, it is allowed to directly call inject to obtain the value after call provide in the same component.25*26* @example27* ```ts28* injectLocal('MyInjectionKey', 1)29* const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 130* ```31*32* @__NO_SIDE_EFFECTS__33*/34export declare const injectLocal: typeof inject35```36