You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-4Lines changed: 30 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -235,8 +235,8 @@ List of 300 VueJS Interview Questions
235
235
|226|[What happens if you use duplicate field names?](#what-happens-if-you-use-duplicate-field-names)|
236
236
|227|[Why the component data must be a function?](#why-the-component-data-must-be-a-function)|
237
237
|228|[What is the reason for recommendation for multi-word component names?](#what-is-the-reason-for-recommendation-for-multi-word-component-names)|
238
-
|229|[](#)|
239
-
|230|[](#)|
238
+
|229|[How to use composition API in Vue2.0?](#how-to-use-composition-api-in-vue2.0)|
239
+
|230|[What is composition API?](#what-is-composition-api)|
240
240
241
241
1.### What is VueJS?
242
242
**Vue.js** is an open-source, progressive Javascript framework for building user interfaces that aim to be incrementally adoptable. The core library of VueJS is focused on the `view layer` only, and is easy to pick up and integrate with other libraries or existing projects.
@@ -4941,10 +4941,36 @@ List of 300 VueJS Interview Questions
4941
4941
4942
4942
**[⬆ Back to Top](#table-of-contents)**
4943
4943
4944
-
229. ### ?
4944
+
229. ### How to use composition API in Vue2.0?
4945
+
Even though the Composition API is a part of Vue 3, it has been made available for Vue 2 as well by installing `@vue/composition-api` as a plugin via `Vue.use()`.
4946
+
4947
+
Let's see the usage in step by step instructions,
4948
+
4949
+
1. Run the below commands to install
4950
+
```javascript
4951
+
npm install @vue/composition-api
4952
+
# or
4953
+
yarn add @vue/composition-api
4954
+
```
4955
+
4956
+
2. After that import this API in your main.js file,
4957
+
4958
+
```js
4959
+
importVuefrom'vue'
4960
+
importVueCompositionAPIfrom'@vue/composition-api'
4961
+
4962
+
Vue.use(VueCompositionAPI)
4963
+
```
4964
+
3. Now your project is able to use composition API
0 commit comments