useEvent
Bind event to current fork instance to use in dom event handlers. Used only with ssr, in application without forks useEvent
will do nothing
useEvent(unit)
Arguments
Returns
(Function): Function to pass to event handlers. Will trigger a given unit in current scope
Example
import { createDomain } from "effector";
import { useEvent } from "effector-vue/ssr";
const app = createDomain();
const inc = app.createEvent();
const $count = app.createStore(0).on(inc, (x) => x + 1);
export default {
setup() {
const counter = useStore($count);
const incFn = useEvent(inc);
return {
incFn,
counter,
};
},
};