use-state-vue-sm
v0.0.4
Published
Simple useState() for Vue
Downloads
5
Maintainers
Readme
use-state-vue
Simple replica of React useState()
for Vue 3.
Install
npm install use-state-vue
Usage
import useState from 'use-state-vue';
const [count, setCount] = useState(0);
setCount(count + 1);
Idea behind this library
This library tries to replicate the useState()
hook present in React.
The equivalent in Vue 3 is something like:
import { ref } from 'vue';
const count = ref(0);
const increment = () => {
count.value += 1;
};