vuejs / vuejs/docs

Add a doc section on composables with guidelines about how to write them in the correct idiomatic way

Open
#1,293 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Vue
Stars
3.2k
Forks
5k
Avg merge
14d 17h
Merged PRs (30d)
1

Description

There are some significant composable libraries out there. And, since using the composition api and composables is such a great reuse tool it would be nice to know how to avoid problems.

Document the "useFeature" paradigm and how it interacts with the component scope and how reactivity works.
Examples, some of which I still don't understand fully:

  • why the useFeature naming is a good idea
  • does useFeature need to be exported by name like import {useRoute} from 'vue-router or should I export it as the default
  • global vs local/component scope in the composable
  • if I create a composable useFeature and it needs to use vue router then useRouter() must be inside the useFeature function so it ends up in the proper scope in the component.
  • how does reactivity work
    • computed function inside useFeature function
    • computed function outside useFeature function
    • passing a component prop to useFeature(props.something)
    • etc

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing Vue documentation structure and current guidance on the Composition API and composables. Cover the useFeature naming and export questions, component scope, vue-router usage, and the listed reactivity cases; done when the guidance and examples explain each question clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.