Skip to content

Commit af45f62

Browse files
committed
start to add in a components sample
1 parent f889b81 commit af45f62

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/cookbook/gradual-compositionapi-migration.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,23 @@ For instance, if you have a component has the following methods:
147147

148148
You may find that you can potentially create a reusable component for the API call, as on a large application there's a fairly high chance you will need to make another.
149149

150+
For the purposes of demonstration, here's how that one method refactor might look.
151+
152+
### Before, with a Tightly Coupled Method
153+
154+
```js
155+
methods: {
156+
gitHubAPI() {
157+
158+
}
159+
}
160+
```
161+
162+
### After, with Composition API
163+
164+
```js
165+
```
166+
150167
[VueUse](https://vueuse.js.org/) is a great resource to explore that covers many of these encapsulated use cases.
151168

152169
## Alternative Patterns

0 commit comments

Comments
 (0)