Skip to content

Latest commit

 

History

History
48 lines (37 loc) · 800 Bytes

README.md

File metadata and controls

48 lines (37 loc) · 800 Bytes

About

This Vue hook was created as an sample to explain the process to create publishable Open Source Vue libraries.

Tutorial on Medium!

Usage Demo Stackblitz

Install

npm install vue-use-counter

Usage

<template>
  <div id="app">
    <div>
      {{ counter }}
    </div>
    <div>
      <button @click="handleClick">Inc</button>
    </div>
  </div>
</template>

<script>
import { useCounter } from 'vue-use-counter';

export default {
  name: 'App',
  setup() {
    const { counter, inc } = useCounter();

    function handleClick() {
      inc();
    }

    return {
      counter,
      handleClick,
    };
  },
};
</script>