createComponent(componentOptions, store?)
Arguments
componentOptions
(Object): component options ( hooks, methods, computed properties )store
(Object): Store object from effector
Returns
(vue component
)
Example
<template>
{{ $counter }}
</template>
// component.vue
import {createComponent} from 'effector-vue'
const $counter = createStore(0)
const {update} = createApi($counter, {
update: (_, value: number) => value,
})
export default createComponent(
{
name: 'Counter',
methods: {
update,
handleClick() {
const value = this.$counter + 1 // this.$counter <- number ( typescript tips )
this.update(value)
},
},
},
{$counter},
)