import { useEvent } from "effector-vue/ssr";
Deprecated

Since effector 23.0.0 useEvent is deprecated. Use useUnit instead.

Bind event to current fork instance to use in dom event handlers. Used only with ssr, in application without forks useEvent will do nothing

Methods

useEvent(unit)

Arguments

  1. unit (Event or Effect): Event or effect which will be bound to current scope

Returns

(Function): Function to pass to event handlers. Will trigger a given unit in current scope

Examples

Basic

import { createStore, createEvent } from "effector";
import { useEvent } from "effector-vue/ssr";

const incremented = createEvent();
const $count = createStore(0);

$count.on(incremented, (x) => x + 1);

export default {
  setup() {
    const counter = useStore($count);
    const onIncrement = useEvent(incremented);

    return {
      onIncrement,
      counter,
    };
  },
};
Contributors