react-hook-vue-composition
v0.0.2
Published
> React hook that mimics the [Vue Composition API](https://vue-composition-api-rfc.netlify.com)
Downloads
2
Readme
react-hook-vue-composition
React hook that mimics the Vue Composition API
WIP: the api may change a bit
Install
npm install --save react-hook-vue-composition
Usage
import React from "react";
import useVueComposition from "react-hook-vue-composition";
function setup({ ref }) {
const count = ref(0);
function increment() {
count.value++;
}
return { count, increment };
}
function CountButton() {
const { count, increment } = useVueComposition(setup);
return <button onClick={increment}>Count is: {count}</button>;
}
Check ./example
folder for more examples!
License
This hook is created using create-react-hook.