A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://effector.dev/en/api/effector-vue/createGate below:

Website Navigation


createGate | effector

Creates a Gate to consume data from view, designed for vue 3. If defaultState is defined, Gate.state will be created with passed value.

Methods createGate(config?: {defaultState?, domain?, name?}) Arguments

config (Object): Optional configuration object

Returns

Gate

Examples Basic Usage

import { createGate, useGate } from "effector-vue/composition";

const ListGate = createGate({

name: "Gate with required props",

});

const ListItem = {

template: `

<div>

{{id}}

</div>

`,

props: {

id: {

type: String,

required: true,

},

},

setup(props) {

useGate(ListGate, () => props.id);

},

};

const app = {

template: `

<div>

<ListItem :id="id" />

</div>

`,

components: {

ListItem,

},

setup() {

const id = ref("1");

return { id };

},

};

Gate.state.watch((state) => {

console.log("current state", state);

});

// => current state null

app.mount("#app");

// => current state 1

app.unmount();

// => current state null

More

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4