React hook that mimics the Vue Composition API
npm install --save react-hook-vue-composition
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!
This hook is created using create-react-hook.